pdb-form_element_build_ setting options *and* values?
-
Hi again Roland – thanks for all your help with my first project using PDb a couple of months ago. I now have another project for which your awesome plugin is ideal and have a quick question if I may:
I need to populate a multi-select checkbox field from some Advanced Custom Field on a Custom Post Type.
Following your tutorial at https://xnau.com/populate-a-form-dropdown-from-the-database/ and modifying it with my WP query to get the data, I have successfully used pdb-form_element_build_multi-checkbox to set the checkbox labels as needed. I notice that the values of the checkboxes are the same as the labels and wondered if there is a way to set this in the same function?
I have tried a couple of things like:
$field->options = $options; $field->values = $values;(where values is an array of the values)
which didn’t work, and then tried
$options[] = $event_name."-".$event_dates. "-".$event_city."::".$event_code;
in the hope that using the :: label/value separator might do the trick, but no joy.Is there a way to set the values as well as the labels when using pdb-form_element_build_ ? Or do I need to construct a custom form element for this?
Thanks!
The topic ‘pdb-form_element_build_ setting options *and* values?’ is closed to new replies.