I have an enquiry form that appears on every 'product page' which dynamically populates a text box with the product name, so far so good, but I'd like to add a dynamic drop-down to let the user pick a colour from the available colours.
Colours are stored in an array in a custom field, but I can't figure out how to use this custom field to populate a drop-down. Using the same code for the text field but using an array does not seem to work. Please see my code below and let me know where I am going wrong?
add_filter("gform_field_value_colour", "populate_list");
function populate_list($value){
$choices[] = array(array('text' => 'Colour name', 'value' => 'colour name'));
$choices[] = array(array('text' => 'Colour name 2', 'value' => 'colour name 2'));
return $choices;
}
Regards
Shaun