Dynamically change the combobox list in a form

Hi

I’ve got a form which includes two comboboxes. The contents of the second combobox depend on the selection a user makes in the first combobox. I’m able to retrieve the data from the first combobox and create a new array which should be used for the second combobox.

When I’m using just two comboboxes (NO FORM), I’m able to do myComboBox.data.parse(newArray). And that works just fine. But in a form that syntax won’t work. Neither does myForm.getItem(‘myCombo’).data.parse. I also can’t use the SetProperties on the attribute data.

Is there a way I can populate the entire combobox on the fly?

Thanks
Kevin

Please, try to use:

var myComboBox= form.getItem("myCombo").getWidget();
myComboBox.data.parse(newArray)

It is mentioned here:
https://docs.dhtmlx.com/suite/form__combo.html#workingwithcombo
right at the bottom of the page. :sweat_smile:

I have the same Problem, but when i use:
var combo = _empb_edit_form.getItem(“kundennummer”).getWidget();

then i get:
getWidget is not a function

greeting
Peer

Unfortunately I was not able to reconstruct your issue locally.
Please, checck the following snippet:
https://snippet.dhtmlx.com/za923umc
If the problem still occurs for you please, provide a complete demo or a demo link, where the problem could be reproduced.

Thanks a lot,

my config was wrong, in my config was the type “select”.

greeting peer