Welcome Guest, Not a member yet? Register   Sign In
Form helper and classes for options
#1

[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 Smile

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.
#2

[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"] {
color: red;
font-weight: bold;
}

I have not tested this, but it seems like it should work.
#3

[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.




Theme © iAndrew 2016 - Forum software by © MyBB