How to get all selected rows in the mutli-selection listbox?

Hi,

I have created a multiple selection listbox with
rails, when I try to get the rows selected by user,
rails send back only the first one, how can I get the
other selected rows???

I created the listbox with the following function:

select_tag(“form__list1”,
options_for_select([“A”,“B”,“C”,“D”], selected = “A”),
html_options = {“size” => 5, “multiple” => true})

What I get from params is :

!map:HashWithIndifferentAccess
commit: Next
action: index
controller: cellfiles
form__list1: “A”

Thanks you very much

Saiho


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

I’m not sure, but try adding square brackets like this:

select_tag(“form__list1[]”,

Estelle.

Hi,
I have created a multiple selection listbox with
rails, when I try to get the rows selected by user,
rails send back only the first one, how can I get the
other selected rows??? I created the listbox with the
following function:

select_tag(“form__list1”,
options_for_select([“A”,“B”,“C”,“D”], selected = “A”),
html_options = {“size” => 5, “multiple” => true})

What I get from params is :

!map:HashWithIndifferentAccess
commit: Next
action: index
controller: cellfiles
form__list1: “A”

Thanks you very much

Saiho


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

hmm you might need to do something like form_list1[] instead of just
form_list1 to get all the values into an array.

try that

adam

Saiho,

Try this:

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 Y. [email protected] wrote:

html_options = {“size” => 5, “multiple” => true})


Cody F.
http://www.codyfauser.com

It works:)!!! Thanks you and Thank you very much
!!!

— Cody F. [email protected] wrote:

following function:
action: index
protection around
Cody F.
http://www.codyfauser.com


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

If God really exists, I would like to
know what the dinosaurs have done to
deserve their extinction.

Water is unknown to fishes,
until they discover air.

http://www.geocities.com/sayoyo/


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Hi Adam,

Finally, I understand how to make it works:) Thanks
you and Thank you very much !!!

Saiho

— Adam D. [email protected] wrote:

Hi,
options_for_select([“A”,“B”,“C”,“D”], selected =

Rails mailing list
[email protected]

http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

If God really exists, I would like to
know what the dinosaurs have done to
deserve their extinction.

Water is unknown to fishes,
until they discover air.

http://www.geocities.com/sayoyo/


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Hi,

I try this but, it doesn’t work

form__list1 = []
select_tag(form__list1,
options_for_select([“A”,“B”,“C”,“D”], selected =“A”),
html_options = {“size” => 5, “multiple” => true})

I get only A even I chose A,B,C

!map:HashWithIndifferentAccess
“”: “A”
commit: Previous
action: index
controller: atlasmain

have any idea???

Thanks you very much!!!

Saiho

— Adam D. [email protected] wrote:

Hi,
options_for_select([“A”,“B”,“C”,“D”], selected =

Rails mailing list
[email protected]

http://lists.rubyonrails.org/mailman/listinfo/rails


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Hi, Estelle

It works:)!!! Thanks you and Thank you very much
!!!

Saiho

— Estelle W.
[email protected] wrote:

Hi,
select_tag(“form__list1”,
form__list1: “A”
http://mail.yahoo.com


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs