My wild guess is that you should override addMultiOptions in a custom
select element so that you can add the class attribs.
-Bart
Op 21-07-11 21:49, David Mintz schreef:
From my googling I see that this has been asked, and there's no really easy
answer, and none of the few answers I found work for my case.
Basically, you have a label, a value and a category signified by the css
class. I want the output to be something like
<option label="apple" class="fruit" value="1">apple</option>
<option label="spinach" class="vegetable" value="w">spinach</option>
<option label="salmon" class="fish" value="1">salmon</option>
And yes, I know there are option groups for organizing OPTION elements into
a hierarchy, but I have my reasons for not wanting to go there.
This will all come from a database. In high-level terms, how would you
suggest approaching this? What classes/methods would you look into
overriding?
The purpose is to do fancy tricks using jQuery -- I need to detect the
"category" on the change event. I can think of ways of hacking around this,
e.g., load a JSON data structure that maps ids to categories and refer to
that as needed. But... any other ideas?
Thanks.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]