Forum: Ruby on Rails List Menu

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Hasana H. (Guest)
on 2007-03-19 11:46
In ruby, can i change the "text_field" to "list menu"? For example like
below...


<tr><td><div align="right"><label
for="registration_gender"><strong><font color="red">*</font>Gender
:</strong></label></div></td>
<td><div align="left"><%= text_field 'registration', 'gender'
%></div></td></tr>
Marc L. (Guest)
on 2007-03-19 12:09
(Received via mailing list)
Sure.  For this simple example you would use the select method.
Instead of <%= text_field 'registration', 'gender' %>, you'd use:

<%= select 'registration', 'gender', {"Male" => "Male", "Female" =>
"Female"}, { :include_blank => true } %>

Check the <a href="http://api.rubyonrails.org/classes/ActionView/
Helpers/FormOptionsHelper.html#M000506">documentation</a> for more
details.

Marc

On Mar 19, 2:46 am, Hasana H. <removed_email_address@domain.invalid>
Hasana H. (Guest)
on 2007-03-19 17:47
Thank you very much..it works.
This topic is locked and can not be replied to.