Hi how can i define a preselct value for the Select Tag? <%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, { :selected => ''2'' } ) %> Where is the mistake? greetings, chaos -- 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 -~----------~----~----~----~------~----~------~--~---
On 13 Jul 2008, at 19:40, Andi Geheim wrote:> > Hi > > how can i define a preselct value for the Select Tag? > > <%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, { > :selected => ''2'' } ) %> > > Where is the mistake?:selected => 2 Fred> > > greetings, chaos > -- > 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 -~----------~----~----~----~------~----~------~--~---
Andi Geheim wrote:> Hi > > how can i define a preselct value for the Select Tag? > > <%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, { > :selected => ''2'' } ) %> > > Where is the mistake? > > greetings, chaoshave you tried putting the :selected value as an integer? I imagine it needs to match the exact value of c.id to work. <%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, {:selected => 2 } ) %> -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> > :selected => 2 > > FredDang... should have answered quicker. -- 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 13 Jul 2008, at 19:40, Andi Geheim wrote: > >> >> Hi >> >> how can i define a preselct value for the Select Tag? >> >> <%= select(:bla, :bla_id, @blaa.collect {|c| [c.name, c.id]}, { >> :selected => ''2'' } ) %> >> >> Where is the mistake? > > :selected => 2 > > FredYeah! This was my first post and i got so many responses, i am enthused! I could swear i tried this, but integer was the right point! :) Thanks a lot, cu next time! :-) greetings chaos -- 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 -~----------~----~----~----~------~----~------~--~---