How to select multiple entries in a select box in rhtml ? In html , it can be done by setting ''multiple=true''. But in rhtml ''select-tag'', how to do this ? Pls suggest me ! -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, you can simply write it in standard HTML. Good luck, -Conrad On 3/16/07, Muruga Raj <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > How to select multiple entries in a select box in rhtml ? > In html , it can be done by setting ''multiple=true''. But in rhtml > ''select-tag'', how to do this ? Pls suggest me ! > > -- > 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 -~----------~----~----~----~------~----~------~--~---
cafonso62-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-17 08:53 UTC
Re: Multiple selection in select box in Rhtml
select_tag(''letters[]'', options_for_select([''A'',''B'',''C'',''D''], ''A''), :size => 5, :multiple => true) You need to add the [] to the name to get back an array of selected values. On 2/3/06, Saiho Yuen <sayoyo-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> html_options = {"size" => 5, "multiple" => true}) > >-- Cody Fauser http://www.codyfauser.com Muruga Raj escreveu:> How to select multiple entries in a select box in rhtml ? > In html , it can be done by setting ''multiple=true''. But in rhtml > ''select-tag'', how to do this ? Pls suggest me ! > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Very Good Answer ! Any way Thanks!! Conrad Taylor wrote:> Hi, you can simply write it in standard HTML. > > Good luck, > > -Conrad-- 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 -~----------~----~----~----~------~----~------~--~---
That works great! Thanks!! But what if I need to display the form with more then one value already selected? I tried select_tag(''letters[]'', options_for_select([''A'',''B'',''C'',''D''],''A'',''B''), :size =>5, :multiple => true) but that raised the following error: "Wrong number of arguments (3 for 2)". Any suggestions? On Mar 17, 1:53 am, cafons...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> select_tag(''letters[]'', options_for_select([''A'',''B'',''C'',''D''], ''A''), > :size => 5, :multiple => true) > > You need to add the [] to the name to get back an array of selected > values. > > On 2/3/06, Saiho Yuen <say...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> html_options = {"size" => 5, "multiple" => true}) > > -- > Cody Fauserhttp://www.codyfauser.com > > Muruga Raj escreveu: > > > How to select multiple entries in a select box in rhtml ? > > In html , it can be done by setting ''multiple=true''. But in rhtml > > ''select-tag'', how to do this ? Pls suggest me ! > > > -- > > 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 -~----------~----~----~----~------~----~------~--~---