Conditional Dropdown values / SubCategories

Is there a js function to enable Conditional Drop-downs, or Sub-Categories?

For example, if I choose particular Product Category, say “Product Category A”, in an initial drop-down field, then the next drop-down field will only display the Product Types within Product Category A…so on.

Dear Dave.

 

I wish it could be narrowed down the Drop-downs field too.
but,I want to avoid to edit DOM nodes and attributes.
(The id/class attributes of each element used in kintone may be changed without any notice.)

then.I have a proposition.

 

using the RADIO_BUTTON value, app.record.edit.change & kintone.app.record.setGroupFieldOpen

you can open and close field group that contain the filtered dropdowns, 

 

A little different way to what you asked for, but this is virtually the same as what you want to do.(I think…)

see sample code below.

 

 


(function() {
    “use strict”;
    //check events through value of RADIO_BUTTON field
    var eventsSubmit = [‘app.record.detail.show’,
                        ‘app.record.create.show’,
                        ‘app.record.edit.show’,
                        ‘app.record.create.change.RADIO_BUTTON’,
                        ‘app.record.edit.change.RADIO_BUTTON’];
    kintone.events.on(eventsSubmit, function(e) {
        var record = e.record;
        var radioButtonValue = record.RADIO_BUTTON.value;
        //close all of Group field by Open Field Group API
        kintone.app.record.setGroupFieldOpen(‘group_failure’, false);
        kintone.app.record.setGroupFieldOpen(‘group_demand’, false);
        kintone.app.record.setGroupFieldOpen(‘group_question’, false);
        kintone.app.record.setGroupFieldOpen(‘group_other’, false);
        //switch open field group by value of RADIO_BUTTON field
        switch (radioButtonValue) {
            case “failure”:
                kintone.app.record.setGroupFieldOpen(‘group_failure’, true);
                break;
            case “group_demand”:
                kintone.app.record.setGroupFieldOpen(‘group_demand’, true);
                break;
            case “group_question”:
                kintone.app.record.setGroupFieldOpen(‘group_question’, true);
                break;
            case “group_other”:
                kintone.app.record.setGroupFieldOpen(‘group_other’, true);
                break;
        }
    });
})();