I have a credform field :
[cred_field field='@government-address.parent' required="true" class='form-control select-government' output='bootstrap' select_text='--- not set ---']
This field lists all the governments that can be associated with an address. This field allows me to associate multiple addresses with a single government (This works fine).
I would like to make the selection of the government using code.
For example if one of the governments in the list was "New York", I would like to write code that selects "New York" instead of having to manually select it (for example: SelectItem("New York)).
Hello. Thank you for contacting the Toolset support.
Actually - the select field value will be stored as a numeric value and you would like to target using the option text.
You need to add custom JS/jQuery code in order to achieve such a custom requirements. Please check the following example that might help you to implement it:
=> hidden link
Thanks for your help. The solution you gave me works for a selection box that I create.
The selection box toolset provides for selecting a related post is more complex.
For example, when I click on that selection box, it begins searching for the posts. It appears the selection box is initially empty until you click on it.
When I use the method you provided me to get the number of options, the count is ZERO.
But when you click on it, it says "searching..." and then the drop down shows the post titles and the values of each entry is the post id.
This is the CRED FIELD : [cred_field field='@government-address.parent' required="true" class='form-control select-government' output='bootstrap' select_text='--- not set ---']
Is there a way to auto fill the selection box? Otherwise, I will need to make my own control.
Can you please share the problem URL where I can see the field as well as access details.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.