• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Action called twice for single form submission
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Action called twice for single form submission


  • Subject: RE: Action called twice for single form submission
  • From: Peter Vandoros <email@hidden>
  • Date: Mon, 05 Apr 2004 11:25:09 +1000

I had a similar problem once and i found the problem to be an image on the
page that did not exist in WebServerResources or a wrong url in for the page
stylesheet, i can't remember which.


Message: 2
From: Allen Cronce <email@hidden>
Subject: Action called twice for single form submission
Date: Sat, 3 Apr 2004 10:01:35 -0800
To: email@hidden

Hi all,

I and others have been talking about this on the Omni group list, so I thought I'd post here too.

I spent several hours yesterday and today debugging an editing context problem. It turns out that the problem is a side effect of the fact that a WOSubmitButton action is unexpectedly being called twice. This results in instancing a new page, rendering that page, then the action is called again, instancing another copy.

Using an override of dispatchRequest in my Application, I've verified that the browser is performing both a POST and a GET of the form action. This does not seem to be a WebObjects bug.

So the for the following source:

<form method="post" action="/cgi-bin/WebObjects/MyApp.woa/wo/JvsF931ATM5b1C7InWdNZw/ 17.0.17.9">
<p style="text-align: center"><INPUT TYPE=SUBMIT NAME="Begin" VALUE="Begin Process"></p>
</form>


Safari and IE Mac perform a POST of the action URL, calling my action method, which constructs and renders the next page. Then after the page is displayed, the browser performs a GET of the same action URL, which constructs the page again (although the browser doesn't render it). This happens to cause bad side effects in my application on certain pages.

I admit that I'm not an HTTP expert and never written a browser, so I'm a little unclear as to why Safari and IE are performing both a POST and a GET. It certainly seems wrong to me. Incidentally, Mozilla does not do this. It just does the post, as I would expect.

Fortunately there is a work around. When I change the form definition in the wod file to explicitly specify a "get" method binding, Safari does one (and thankfully only one ;-) get request. This should be OK because in the pages where this is a problem, I'm just using the submit button as a "Next" link, so there are no form values.

Does this seem like a reasonable work around, or is there a better, more general solution? Should WO detect a GET following a POST for the same URL and suppress it?

Best regards,
--
Allen Cronce
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • UTF-8 in generated e-mails?
      • From: Allen Cronce <email@hidden>
    • Action called twice for single form submission --> SOLVED
      • From: Allen Cronce <email@hidden>
  • Prev by Date: refuseNewSessions knocks out app instance
  • Next by Date: Re: Synchronizing data displayed by two instances of my app
  • Previous by thread: Action called twice for single form submission
  • Next by thread: Action called twice for single form submission --> SOLVED
  • Index(es):
    • Date
    • Thread