Cascading dropdown lists from json

Hi,

I want to create two comboboxes where value of second combo box is dependent on the first combo box. Also, the second box can be a textbox or a dropdown based on the value of the first box.

Can anyone help me with it using webix ui?

Hello, @PurpleApollo

To link two or more controls you can track changes in the “master” combo and change the visibility/reload options of the dependent widgets.

To get the moment of changing the first combo value, use the onChange event. Then you can reach the drop-down list of the options for combo (via the getList() method) and then (depending on your logic) reload options in the dependent combo with parse(data) method or show a text control instead of it (visibility of each widget can be changed with hide/show methods).
Pay attention, it’s necessary to clean combo options before setting new ones. For this purpose use clearAll() method.
Here is the snippet: Code Snippet

Another option to manage visibility is to use batches in form. The general solution will be the same, but perhaps it’ll reduce the code a bit.
Here is an example: Code Snippet

To exclude hidden controls while getting form values, you can use getValues with the related flag:

 form.getValue({ hidden: false })