![]() |
Form helper and classes for options - 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: Form helper and classes for options (/showthread.php?tid=38178) |
Form helper and classes for options - El Forum - 02-01-2011 [eluser]bigspring[/eluser] Hey guys, First post here from a week old CI user. First things first, this framework is excellent. I'm fairly new to PHP frameworks and I can't believe I've lived without them for the last two years! It's probably good for my understanding of PHP anyway ![]() What I'm trying to do is assign a class to an option value using the form helper but I can't see anything that suggests you can (other than generating the options without the helper). Any ideas? Thanks. Form helper and classes for options - El Forum - 02-01-2011 [eluser]Victor Michnowicz[/eluser] I don't think you can do exactly what you are trying to do. However, depending on what you are trying to do, this may work: Make sure that you are setting the third parameter of set_select() to select a default option. Then, in your CSS, you should be able to target it like so: Code: option[selected="selected"] { I have not tested this, but it seems like it should work. Form helper and classes for options - El Forum - 02-01-2011 [eluser]bigspring[/eluser] Thanks for the advice. I don't think that will work in my case because I need to be able to select one entry, plus assign a class to any number of the options. That's fine though, I'll either extend the helper or create the options manually. Thanks. |