On Fri, Jan 6, 2012 at 2:00 AM, Brynjolfur Thorvardsson <[email protected]>wrote:

> Hi, this sounds like a javascript problem. Javascript is executed
> asynchroniously on your browser so clicking fast means that you are sending
> more than one submit from the same form, causing Rails to return more than
> once from the controller. There are probably many ways to avoid this but
> one is to put in a delay of say half a second in your javascript submit
> code. ****
>
> **
>

Yes, that's what I found. I send a lot of ajax request because the function
that do the submit is this

function save_response_with_ajax(t){
$('#edit_response_set_' + t).submit();
}

I think that its way to simple and without any kind of validation and the
radio button is this

<%= rs_a_form.input :answer_id, :collection =>
response_set.question.answers.map { |a| [build_choice(a) , a.id] }, :as =>
:radio, :input_html => {:onclick => 'save_response_with_ajax(' +
response_set.id.to_s + ');'} %>

Should I change that submit() into a $.ajax() ?

Thanks

Javier

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

Reply via email to