Thanks for the reply, Peter. I could walk the dom, and in fact I'm using jQuery, but I'm shooting more for a pattern-based approach to accomplishing this task. Here's a little more background as to why I need (er, want) CSS class names.
I am building a search form that contains a multiCheckbox element with 5 options: 104 => Fruit 125 => Vegetables 393 => Water 442 => Soda 570 => Beer Some of the options have their own configuration settings to further refine how that option is searched. Those fields are placed in a fieldset: <fieldset id="fieldset-food> /* elements that affect how "food" is searched */ </fieldset> So, in jQuery, I need to find all of the "food" options and place a "configure" button next to them, which shows/hides the related fieldset in a modal window when clicked. The problem is, without class names it is difficult to determine which options are "food' and which are "drinks". My current workaround is to hard-code my javascript to find the "fruit" and "vegetables" options and tie them to the "food" fieldset, but I would much rather give them a class name so that it works for new categories without the need to modify the javascript. Another option I've considered, although a bit ugly, is to prepend the value with the type: food-104 => Fruit food-125 => Vegetables drink-393 => Water drink-442 => Soda drink-570 => Beer But this would make things a bit uglier when working with the submitted values. Unless I'm mistaken, I think there are two other viable options: 1. Disable escaping and wrap the label in a span: 104 => <span class="food">Fruit</span> 2. Create a new (or extend) formMultiCheckbox helper to accept per-option attributes. As a lazy programmer, I think I'm going to try option #1 and see how it goes. :) -- Hector On Thu, Aug 13, 2009 at 1:14 AM, Peter Warnock <[email protected]>wrote: > On Tue, Aug 11, 2009 at 11:07 AM, Hector Virgen <[email protected]>wrote: > >> >> >> I am building a form that uses the multiCheckbox form element. I need to >> add class names to specific checkboxes for javascript purposes. Is there a >> way to do that? >> >> -- >> Hector >> > > Why not navigate the dom with javascript? jQuery makes this very easy. - pw >
