EllisLab text mark
Advanced Search
     
Why, in form_helper.php, is form_dropdown different in form than the other form functions?
Posted: 03 August 2007 10:39 PM   [ Ignore ]
Joined: 2007-08-03
4 posts

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

 
Posted: 04 August 2007 04:25 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-11
2985 posts

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.

 Signature 

————————
Blog | Twitter | GitHub | BitBucket
————————-
PyroCMS - open source modular CMS built with CodeIgniter
PancakeApp - Simple, hosted invoicing/w project management

 
Posted: 04 August 2007 04:32 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Joined: 2007-08-03
4 posts

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.

 
Posted: 04 August 2007 10:31 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2007-06-11
2985 posts

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!

 Signature 

————————
Blog | Twitter | GitHub | BitBucket
————————-
PyroCMS - open source modular CMS built with CodeIgniter
PancakeApp - Simple, hosted invoicing/w project management

 
Posted: 09 October 2007 07:09 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2006-06-23
370 posts
ccw39 - 04 August 2007 08:32 PM

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.

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.

 Signature 

Mac OS X 10.8, Apache 2.x, NGiNX, PHP 5.4.x, CodeIgniter 1.7.2/2.1.3