Using form_remote_tag I get this generated HTML: <form onsubmit="new Ajax.Request(''/article/ajax_add_comment?submit_button_id=submit_comment_button_3000'', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" method="post" action="/article/ajax_add_comment?submit_button_id=submit_comment_button_3000"> 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 -- Posted via http://www.ruby-forum.com/.
Hi Mike Papper Can you paste your original form_remote_tag code? Sijo -- Posted via http://www.ruby-forum.com/.
Sijo k g wrote:> Hi Mike Papper > > 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 %> <div class="info">Write a comment:</div> <div class="comment"> <%= text_area_tag ''text'', @text %> <div id="char_msg" class="remaining"> <%= javascript_tag("Rgm.addControl(''_5d_char_counter'',new Rgm.CharCounter(''text'',''char_msg'',''{NUMB} characters remaining.'', 1000)); ") %> </div> </div> <%= 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 -- Posted via http://www.ruby-forum.com/.
FYI, here is the entire html form (care of Firebug as some of it is generated via previous Ajax calls): <form onsubmit="new Ajax.Request(''/article/ajax_add_comment?submit_button_id=submit_comment_button_3000'', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;" method="post" action="/article/ajax_add_comment?submit_button_id=submit_comment_button_3000"> <input id="article_global_id" type="hidden" value="1000" name="article_global_id"/> <input id="category_global_id" type="hidden" value="20052" name="category_global_id"/> <input id="js_object" type="hidden" value="comment_drawer" name="js_object"/> <div class="info">Write a comment:</div> <div class="comment"> <textarea id="text" name="text"/> <div id="char_msg" class="remaining">995 characters remaining.</div> </div> <div class="footer"> <span class="button first"> <a id="cancel_link" href="#">Cancel</a> </span> <span class="button second"> <input id="submit_comment_button_3000" class="ajax_footer_submit prevent_dbck" type="image" src="/images/buttons/submit.png"/> </span> <div id="message" class="hidden"> Confirm that you would like to cancel this comment </div> </div> </form> -- Posted via http://www.ruby-forum.com/.