Autopopulating Dropdown Fields with Autocomplete Enabled


This Discussion is public


When autocomplete is enabled on a dropdown field, your standard code will not work to autopopulate it.

If you insert any kind of javascript that intends to alter a dropdown field which has autocomplete enabled, the following code snippet has to be added in order for any changes to be reflected : $("select[name='item_meta[123]']").trigger("chosen:updated"); . where item meta[123] is the dropdown field which you are trying to alter.

That little snippet is required for not just conditionally selecting a default value, but also for conditionally hiding / showing certain dropdown options, etc.

Hope this saves you some time!

Reply to this Discussion