Forum: Ruby on Rails AJAX, checkbox array.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F.B. ten Kate (Guest)
on 2007-01-15 15:54
Owkay i currently have a list of checkboxes called: option_ids[], this
will give me a nice  array of the options selected. How ever... every
time the user chnages their options an ajax request should be made, as
follows:

  <%= observe_field("option_ids[]",
              :frequency => 0.25,
              :update => "infoprijs",
                       :url => { :action => :getprijs },
           :with => "formdata = Form.serialize('bestel')") %>
F.B. ten Kate (Guest)
on 2007-01-15 15:56
Owkay, it submited while i wasnt done typing yet... My bad :)

Problem with the code above is that it only handles the ajax request
when the FIRST checkbox is changed, this because all the check boxes
have the same name/id.. Is there any way to fix this without making the
same amount of ajax statements as there are checkboxes, cause i'd think
thats a very unefficient solution.
Melvin R. (Guest)
on 2008-01-07 07:36
F. B., did you ever figure this one out? I have the same need

F.B. ten Kate wrote:
> Owkay, it submited while i wasnt done typing yet... My bad :)
>
> Problem with the code above is that it only handles the ajax request
> when the FIRST checkbox is changed, this because all the check boxes
> have the same name/id.. Is there any way to fix this without making the
> same amount of ajax statements as there are checkboxes, cause i'd think
> thats a very unefficient solution.
This topic is locked and can not be replied to.