I am creating a multiple-selection list box with : <% form__list1 = [] %> <%= select_tag, options_for_select(["A","B","C","D"], selected ="A"), html_options = {"size" => 5, "multiple" => true}) %> I get wrong number of arguments (0 for 1) alluding to form__list1[] . How else should I specify this to not have this error? -Janna B
2009/7/3 JannaB <mistressjanna-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>:> > I am creating a multiple-selection list box with : > > <% form__list1 = [] %> > <%= select_tag, options_for_select(["A","B","C","D"], selected ="A"), > html_options = {"size" => 5, "multiple" => true}) %> > > I get > wrong number of arguments (0 for 1) > alluding to form__list1[] . How else should I specify this to not have > this error? -Janna BI don''t know what form__list1 is for but you have missed the first parameter for select_tag. Also when you have an error it is worth giving more information on the error reported. When putting code in an email it is best to copy and paste it if possible so as to eliminate typos in the mail, and to ensure that the code shown is exactly as in the app. You may have done this of course. Colin> > > >
On Jul 3, 12:33 am, JannaB <mistressja...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> I am creating a multiple-selection list box with : > > <% form__list1 = [] %> > <%= select_tag, options_for_select(["A","B","C","D"], selected ="A"), > html_options = {"size" => 5, "multiple" => true}) %> >I''m not sure what the error that you''re getting is, but there are enough in this fragment to go around. - select_tag shouldn''t be followed by a comma; written that way, you are calling it without arguments. - select_tag requires the first argument to be the name of the field - the final argument to options_for_select is positionial; the "selected = " part is not required (nor is it meaningful). Similarly for html_options. The only thing that both statements will accomplish is setting local variables to the various array values. - keys in the options array are traditionally symbols; not really a bug, but a slightly incorrect idiom. --Matt Jones