CodeIgniter Forums
blank option for dropdowns - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: blank option for dropdowns (/showthread.php?tid=26998)



blank option for dropdowns - El Forum - 01-28-2010

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


blank option for dropdowns - El Forum - 01-29-2010

[eluser]jmadsen[/eluser]
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
http://ellislab.com/codeigniter/user-guide/general/helpers.html