Double POST using form_remote_tag?

Using form_remote_tag I get this generated HTML:

As you can see, it has an onsubmit and an action. The onsubmit sends an
Ajax request. Sometimes, on some browsers (Firefox 3.0.1 on Windows)
this sends 2 HTTP POST requests to our server. One is Ajax one is not.

the users are NOT clicking the button twice. The page has lots of ads
and javascript on it and as well the above javascript is generated from
a previous Ajax call. so there is room for slowness on the browsers part

  • which may cause part of the issue with the double-submit occurring
    about 5% of the time.

Does anyone know of an issue here?

Mike

Hi Mike P.

Can you paste your original form_remote_tag code?

Sijo

Sijo k g wrote:

Hi Mike P.

Can you paste your original form_remote_tag code?

Sijo

<% form_remote_tag(:url => {:controller => ‘article’, :action =>
“ajax_add_comment”,
:submit_button_id => submit_button_id,
:referring_controller_params => @referring_controller_params})
do %>
<%= hidden_field_tag ‘article_global_id’, @article.global_id %>
<%= hidden_field_tag ‘category_global_id’, @category.global_id %>
<%= hidden_field_tag ‘js_object’, @js_object %>

Write a comment:


<%= text_area_tag ‘text’, @text %>

<%= javascript_tag(“Rgm.addControl(’_5d_char_counter’,new
Rgm.CharCounter(‘text’,‘char_msg’,’{NUMB} characters remaining.’,
1000)); “) %>


<%= ajax_footer( {:img_url =>’/images/buttons/submit.png’,
:img_id => submit_button_id,
:link_to => link_to(“Cancel”,”#”, :id => “cancel_link”),
:confirm_message => t(‘confirm.cancel_comment’)} ) %>
<% end %>

ajax_footer is:
def ajax_footer(options = {})
render :partial => ‘/ajax_footer’,
:locals => {:options => options}
end
(but should not make much difference).

Mike

Hi Mike P.

 Though I could not recreate the issue since using another version I 

think this is a similar thread which says it is a problem with firebug

http://stackoverflow.com/questions/283011/firefox-sending-request-twice

Sijo

FYI, here is the entire html form (care of Firebug as some of it is
generated via previous Ajax calls):

Write a comment:
995 characters remaining.
Cancel
Confirm that you would like to cancel this comment