# Double POST using form\_remote\_tag?

**URL:** <https://www.ruby-forum.com/t/double-post-using-form-remote-tag/178889>\
**Category:** Rails\
**Created:** [November 13, 2009, 2:44am UTC](https://www.ruby-forum.com/t/double-post-using-form-remote-tag/178889 "2009-11-13T02:44:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mperham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47c2d/32.png) [@mperham](https://www.ruby-forum.com/u/mperham)\
**Post date:** [November 13, 2009, 2:44am UTC](https://www.ruby-forum.com/t/double-post-using-form-remote-tag/178889/1 "2009-11-13T02:44:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mperham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47c2d/32.png) [@mperham](https://www.ruby-forum.com/u/mperham)\
**Post date:** [November 13, 2009, 5:32am UTC](https://www.ruby-forum.com/t/double-post-using-form-remote-tag/178889/2 "2009-11-13T05:32:54Z")

</div>

Hi Mike P.

Can you paste your original form\_remote\_tag code?

Sijo

---

<div class="post-metadata">

**Author:** ![mperham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47c2d/32.png) [@mperham](https://www.ruby-forum.com/u/mperham)\
**Post date:** [November 13, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/double-post-using-form-remote-tag/178889/3 "2009-11-13T18:32:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mperham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47c2d/32.png) [@mperham](https://www.ruby-forum.com/u/mperham)\
**Post date:** [November 16, 2009, 6:57am UTC](https://www.ruby-forum.com/t/double-post-using-form-remote-tag/178889/4 "2009-11-16T06:57:13Z")

</div>

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

> <https://stackoverflow.com/questions/283011/firefox-sending-request-twice>

Sijo

---

<div class="post-metadata">

**Author:** ![mperham](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e47c2d/32.png) [@mperham](https://www.ruby-forum.com/u/mperham)\
**Post date:** [November 13, 2009, 6:53pm UTC](https://www.ruby-forum.com/t/double-post-using-form-remote-tag/178889/5 "2009-11-13T18:53:45Z")

</div>

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
