nishi
May 11, 2009, 2:09pm
1
Im trying to get the multiple selected data from select_tag., but its
gives single data
I hv written.
<%=select_tag( :cons_attribute_id,options_from_collection_for_select
(Attribute.find_all_by_attributetype(“cons”),
“id”, “name”, 3),:multiple=>true) %>
I hv also written as:
<%=select_tag( :cons_attribute_id[],options_from_collection_for_select
(Attribute.find_all_by_attributetype(“cons”),
“id”, “name”, 3),:multiple=>true) %>
but it gives error… such as method not defined
nishi
May 11, 2009, 2:14pm
2
On May 11, 12:18 pm, nishi [email protected] wrote:
<%=select_tag( :cons_attribute_id[],options_from_collection_for_select
(Attribute.find_all_by_attributetype(“cons”),
“id”, “name”, 3),:multiple=>true) %>
but it gives error… such as method not defined
when you write :foo[] ruby thinks that you want to call the [] method
on the symbol :foo. You can be explicit that you want the symbol with
content foo[] by doing :‘foo[]’
In this case you could also just pass a string to select_tag
Fred
nishi
May 11, 2009, 2:23pm
3
nishi
May 12, 2009, 9:16am
4
Hi Fred,
thx for ur resp.
but i hv one more ques.
here we r using the
options_from_collection_for_select
(Attribute.find_all_by_attributetype(“cons”)
I need a solution where we will get the data from model not directly
by “collection_select”
please give me sm idea, i need it as soon as possible.
nishi
May 12, 2009, 7:57am
5
Thx Fred and Arun.
I got the solution,
<%=select_tag(“attribute_id[]”,options_from_collection_for_select
(Attribute.find_all_by_attributetype(“cons”), “id”, “name”,
3),:multiple=>true) %>