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> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 Hassan
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> 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>
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Thank you very much..it works. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---