Welcome Guest, Not a member yet? Register   Sign In
Why, in form_helper.php, is form_dropdown different in form than the other form functions?
#1

[eluser]ccw39[/eluser]
Hi,

I just had a quick question about a potential bug.

(Line 224) Why in form_helper.php does the function form_dropdown only take $name for it's initial variable instead of taking $data (which is run through parse_form_attributes)? The other form functions (i.e. form_radio, form_checkbox, form_input, form_password, etc) all take $data as their first attribute...which can contain an array of html specifiers like class, name, id, etc.

Was the difference on purpose?

Thanks.

- Cyrus
#2

[eluser]Phil Sturgeon[/eluser]
It may well be that due to form_dropdown requiring an array for options, it would get very messy trying to use an inline multi-dimentional array?

Whatever it is im certain its different on purpose and is in no way a bug. If you think about it, the HTML for select is very different to normal inputs anyway.
#3

[eluser]ccw39[/eluser]
Well, the reason I'm asking is because we were making a form, and needed to pass in extra arguments (class, id, etc). It's convenient to pass those in in $data for the other form elements, but annoying to have to switch to using $extra for the dropdown form element. On of our guys just ended up modifying the core (which I don't like doing since it makes it harder to upgrade) to incorporate the $data parameter.
#4

[eluser]Phil Sturgeon[/eluser]
Ahh theres nothing wrong with modifying the core. Almost every helper file has been replaced with a custom version of my own, just putt the min the application folder and keep a close eye on the changelogs and there wont be any trouble. Just the way life is!
#5

[eluser]coolfactor[/eluser]
[quote author="ccw39" date="1186273967"]Well, the reason I'm asking is because we were making a form, and needed to pass in extra arguments (class, id, etc). It's convenient to pass those in in $data for the other form elements, but annoying to have to switch to using $extra for the dropdown form element. On of our guys just ended up modifying the core (which I don't like doing since it makes it harder to upgrade) to incorporate the $data parameter.[/quote]

I agree that the form_dropdown() should accept an array or string for the first parameter, in order to be consistent with the rest of the form helper functions. I was just bitten with this issue.




Theme © iAndrew 2016 - Forum software by © MyBB