[eluser]coolgeek[/eluser]
I'm having a problem with default (selected) options in forms, but I don't think that the problem lies with form_dropdown.
My observations have shown that failing to specify the third parameter will default to the first option marked up as "selected" in the html (note that this should probably be specified in the user guide):
Code:
form_dropdown('state', $options)
and specifying the third parameter as null generates the desired html (no "selected" option)
Code:
form_dropdown('state', $options, '')
However, even though the html shows no option as selected, the form validation functions and jquery seem to think otherwise.
- the validation 'required' parameter is not recognizing that no option was selected
- jquery is taking action as if an option was selected at $(document).ready
FWIW, I am in fact specifying a fourth parameter, as follows:
Code:
$js = "id=\"state\" class=\"\"";
echo form_dropdown("state", $options, '', $js);
Also, somewhat related (rather than starting a separate thread), I'm trying to put all of my dropdown population functions in an extended form helper. So far, so good, but I'm also putting a validation callback in the helper, and I'm having a problem trying to use the form_validation set_message function. Is this not possible because helpers are procedural, rather than object oriented? If it is possible, can somebody give me a hint here?
Thanks for your assistance