Re: double submit of forms

<[email protected]> Wed, 12 Aug 2009 13:13:45 -0500
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <047619DE22807D4192B0B9EB64E45CC123C20F2969@MSGCMSV21024.ent.wfb.bank.corp>
Thanks, the latest SVN checkout does resolve this.
BTW, I don't think there was any onclick code or
other javascript on that button on my page, I
don't know if you were thinking that there was.

Is there a timescale for the next release?
- Dan

From: Wolfgang Fahl [mailto:[email protected]]
Sent: Wednesday, August 12, 2009 4:33 AM
To: Discussion of use and development of HttpUnit
Subject: Re: [Httpunit-develop] double submit of forms

Dan wrote:
> I am trying to use HttpUnit 1.7 and I am encountering
> an odd behavior where it submits the same form twice
> when using form.submit(SubmitButton).
>
> I do not see this behavior if I manually construct
> a POST request to the same URL with the same params.
>
> Attaching a WebClientListener, in both cases the
> POST to A does a 302 redirect to B and I see the
> requests for A, B, and the related javascript
> files on B (let's call them X).
>
> With the manually constructed POST request I see
> calls for A, B, X but with form.submit(SubmitButton)
> I see A, B, X, A, B, X -  it does everything twice!
>
> output from the server confirms those are genuine server hits.
>
> This was not a problem in an older version of HttpUnit
> that I was using (which was a customized version
> of 1.6 (I think)).
>
> Has anyone seen this bug or know of a work-around?
>
> (example code attached, unfortunately not runnable w/o my server)
Httpunit 1.7 has the ability to react on onclick events properly where javascript is involved. This has led to a new handling of submits which is done in phases. The orchestration of the phases is important for avoiding double submits.

Please try out the latest Subversion trunk. I think we have fixed this already. If your case is different we will probably be able to also fix it quickly base on a JUnit Test.
>(example code attached, unfortunately not runnable w/o >my server)
For a Junit test we'd need a version of your code that contains the culprit javascript and is runnable on the pseudo-server used by the junit tests.

In the bugreport and patch section of the website you might also find some hints and pointers to subversion.


Wolfgang

BITPlan - smart solutions
Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
Tel. +49 2154 811-480, Fax +49 2154 811-481
Web: http://www.bitplan.de
bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548, Geschäftsführer: Wolfgang Fahl

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop