CodeIgniter Forums

Full Version: blank option for dropdowns
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

How can i add a default blank option for dropdowns using form_dropdown() other than specifying it each time in $options array?

El Forum

form_dropdown()is a function in a helper. These are not objects, so you can't really extend them like modles, controllers, etc.

So the easiest would probably be to make your own "wrapper" class that would accept your form_dropdown values, prepend a "" to $options array, and then pass it on to the form_dropdown().

This will explain better