Hi, I have a really simple problem with ruby on rails. Using a basic tutorial and scaffolding I have a form with lines like this: <p><label for="user_game1">Game 1: <%= Game.find(''1'').game %></ label><br/> <%= text_field ''user'', ''game_1'' %></p> and I want to change it from a text field to a drop down menu with three hardcoded values ("Home", "Away" and "Draw"). If someone could help me out that''d be great. Thanks, Craig --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 9 Apr 2008, at 13:53, Craig O Connor wrote:> > Hi, I have a really simple problem with ruby on rails. Using a basic > tutorial and scaffolding I have a form with lines like this: > > <p><label for="user_game1">Game 1: <%= Game.find(''1'').game %></ > label><br/> > <%= text_field ''user'', ''game_1'' %></p> > > and I want to change it from a text field to a drop down menu with > three hardcoded values ("Home", "Away" and "Draw"). >select ''user'', ''game_1'', %w(Home Away Draw) should do the trick. Fred> If someone could help me out that''d be great. > Thanks, > Craig > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Wed, Apr 09, 2008 at 05:53:56AM -0700, Craig O Connor wrote:> > Hi, I have a really simple problem with ruby on rails. Using a basic > tutorial and scaffolding I have a form with lines like this: > > <p><label for="user_game1">Game 1: <%= Game.find(''1'').game %></ > label><br/> > <%= text_field ''user'', ''game_1'' %></p> > > and I want to change it from a text field to a drop down menu with > three hardcoded values ("Home", "Away" and "Draw").<%= select ''user'', ''game_1'', %w(Home Away Draw), :include_blank => true %> You may or may not want include_blank See http://api.rubyonrails.com/classes/ActionView/Helpers/FormOptionsHelper.html#M000940> If someone could help me out that''d be great. > Thanks, > Craig--Greg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---