Ruby on Rails Thursday, March 31, 2011

If you have multiple elements on your page that have the literal value
name="algo" then the last one will "win" and only that one value will
be submitted to the server by the browser. If they are actually
name="algo[]", then you will receive an array of values for algo and
you can iterate over them on the server with each(). In Prototype, you
can get all of the values for the current form in one serialized
string like this (inside your Ajax Request):

... parameters: this.up('form').serialize(), ...

Then your controller method can pick out the ones you want
with :params[:algo] or something like that.

Walter

On Mar 31, 2011, at 8:46 AM, Tobias H. wrote:

> Thanks for the fast request.
>
> Do you also know how it's possible to read all values of different
> selectboxes in different div-tags (but all with the same name "algo")
> with prototype: Is there a way to loop over all those div-tags and
> read
> the value of the selectbox in each div-tag?
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment