AJAX, checkbox array


#1

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’)”) %>


#2

Owkay, it submited while i wasnt done typing yet… My bad :slight_smile:

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.


#3

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 :slight_smile:

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.