So I am using the form helper to generate my forms. Up until now it worked just how I wanted it to work, but I stumbled upon the styling of the options of a form_dropdown.
Basically what I am doing right now is populating the dropdown from the database as can be seen in the following example;
// Set up the array for the colors.
$data_colors = array('0'=>'color');
foreach ($search_colors as $color)
{
$data_colors[$color['color_id']] = $color['name'];
}
echo form_dropdown('color',$data_colors,'0');
Now, the database also got a row called ‘hex’. What I am trying to do is setting the value of hex as background of the option.
Is that even possible or should I go back to manually writing the HTML code of the dropdown on this one?
Thanks.
That seems a little too advanced for the Form Helper’s form_dropdown() function. I can only see the option to give the entire drop down an ID or class and that wouldn’t help since you want to style individual
options. So, yes, it’s back to manually making the HTML code for now.