Autopopulating Dropdown Fields with Autocomplete Enabled

Est. Reading: 1 minute
By: Jonathansav
Created: 12/14/2018
Category:
Difficulty: Intermediate

Autopopulating Dropdown Fields with Autocomplete Enabled

×Warning: This tutorial was created 2169 days ago. Some of the information may be out of date with more recent versions of Formidable. Please proceed with caution and always perform a backup before adding custom code.

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!

Leave a Reply

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crosschevron-leftchevron-rightarrow-right