Re: double submit of forms
"Wolfgang Fahl" <[email protected]> Wed, 12 Aug 2009 12:32:57 +0200
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Organization | BITPlan GmbH |
| Message-ID | <[email protected]> |
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