Topic: Specify Class in a SELECT tag

I am working with the zapatec ajax helpers for forms and would like to specify a class on a rails select but can not figure out the syntax (if possible)- any help please.

For example, on text_fields I specify a class as follows:
<%=text_field 'enrollment', 'student_email', 'size'=>30, 'maxlength'=>30, :class=>'zpFormRequired'%>

which produces this html:
<input class="zpFormRequired" id="enrollment_student_email" maxlength="30" name="enrollment[student_email]" size="30" type="text" value="" />

when I try to do the same for a select form element, I can not get rails to output the class

<%= select("enrollment", "student_t_shirt_size", Enrollment.ValidTShirts, {:class=>"zpFormRequired"})%>

produces this html:
<select id="enrollment_student_t_shirt_size" name="enrollment[student_t_shirt_size]"><option value="" selected="selected"></option>
<option value="XS">XS</option>
<option value="S">S</option>
<option value="M">M</option>
<option value="L">L</option>

Note no class in select statement.  I need the class specified to get the ajax toolkit to work.

Is it possible to specify a class in a rails select form tag helper????


Re: Specify Class in a SELECT tag

The HTML options should be the 2nd hash, so try this:

<%= select("enrollment", "student_t_shirt_size", Enrollment.ValidTShirts, {}, {:class=>"zpFormRequired"})%>

Railscasts - Free Ruby on Rails Screencasts