Disabled combo value in form

Example is here: https://snippet.dhtmlx.com/vv0u2vk3
I want to set default value for disabled combo and it work correct when combo is enable. But when disabled is true, then value is ignored.

How to set value for disabled combo in form?

It does seem that when the combo is disabled, it cannot be updated. This would need to be addressed by the developers. As a workaround, you can enable the combo, update the value, and disable it again to get the value set. If you create the form with the control enabled, it will set the default value as you like; you can then call form.getItem(“item_id”).disable() to disable the combo. Note that the item would need to have an id associated with it to do this (your snippet did not have one defined). And anytime you need to update it in the future, you can do

var cmb = form.getItem("item_id");

If you’re going to be updating that value from a lot of different places in your code, I definitely recommend creating a function that does the above actions, and then just call that function each time you need to update the field value. That’ll keep your code a little cleaner and easier to fix up if the developers resolve this in the future.

1 Like