Re: Two actions with one form submition!
Re: Two actions with one form submition!
- Subject: Re: Two actions with one form submition!
- From: email@hidden
- Date: Sat, 03 Apr 2004 20:34:15 +0000
- Priority: 3 (Normal)
[demime could not interpret encoding binary - treating as plain text]
I would agree that the first suspicion would be something weird in your
page. If you just
create a simple form and nothing else on a test page---does the browser
make two
requests? If not, then it's probably _something_ in the first page that
is causing the double
request. The task then is to start removing things from the first page
until it stops triggering
a double request, then add things back, etc, until you figure out exactly
what is causing the
double request (in some browsers).
The possibilities Chuck lists are the only things I can think of two.
Although neither one
really provides a good explanation for what you're seeing---the fact that
Mozilla doesn't do
it, and the fact that changing the form to a "GET" stops the double
request. I wouldn't expect
either of those things from anything I can think of.
Sure, changing the form to a "GET", so long as you test it and WO seems
okay with it,
seems like an okay workaround. But better to figure out exactly what's
going on before
possibly working around what may be a bug in _your_ code. If you figure
out what's going
on, then next time you'll know how to fix it properly. And if it's a
mistake you made, you can
fix it.
--Jonathan
==============Original message text===============
On Sat, 03 Apr 2004 6:07:19 pm GMT Chuck Hill wrote:
I can't see why the browser would so this unless you are using
JavaScript (and have a scripting error) or have some broken HTML that
is making the browser try and fetch a resource from the app (e.g. an
image tag missing the first /: <img src="images/etc.1,gif">
Chuck
On Apr 3, 2004, at 9:44 AM, Allen Cronce wrote:
> OK, I've dug a little deeper into this problem. 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,
> which constructs the page again. This happens to cause bad side
> effects in my application on certain pages.
>
> I admit that I'm never written a browser and 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 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
> way? Should WO detect a GET following a POST for the same URL and
> suppress it?
>
> Is anyone else out there seeing multiple action calls from forms or am
> I just going nuts?
>
> Best regards,
> --
> Allen Cronce
>
> On Apr 2, 2004, at 8:18 PM, Allen Cronce wrote:
>
>> Hi Will,
>>
>> I just went through something very similar. I spent several hours
>> 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.
>>
>> This doesn't seem to happen in all cases. But I have verified that it
>> always happens on pages that have a single WOForm with a single
>> WOSubmitButton. The WOSubmitButton has an action defined, but the
>> containing WOForm has no action. I'm seeing the problem in both
>> development and deployment.
>>
>> I have not yet checked to see if the browser (Safari 1.2.1 v125.1) is
>> making two requests or not. But I've looked at the HTML source and I
>> see no indication that would lead Safari to generate two requests.
>> This smells like a WO bug.
>>
>> Best regards,
>> --
>> Allen Cronce
>>
>> On Mar 24, 2004, at 6:15 AM, Will Scheidegger wrote:
>>
>>> Guys, I've just lost 5 hours over what I would consider a bug in WO
>>> 5.1 Deployment:
>>>
>>> I have a situation with two components (lets call them A and B).
>>> Component a has a form with multiple submit buttons. I've set the
>>> the corresponding binding to true (WOForm's "multipleSubmit"), but
>>> also had an action bound to it's action binding.
>>>
>>> Now, here's what the documentation has to say about this:
>>> action
>>> Action method that's invoked when the form is submitted. If the form
>>> contains a dynamic element that has its own action (such as a
>>> WOSubmitButton or a WOActiveImage ), that action is invoked instead
>>> of the WOForm's.
>>>
>>> Despite the fact that it says clearly in the docs that the form's
>>> action will not be invoked, when a button's action inside the form
>>> is clicked, in my deployed app that action is being called - always
>>> - and even after sleep() is called on the component, something that
>>> should not be possible in the first place! Anybody seen anything
>>> like this? Doesn't this sound like something's terribly wrong?
>>>
>>> Dang! I hate it when this happens!
>>>
>>> -Will
>>> _______________________________________________
>>> WebObjects-dev mailing list
>>> email@hidden
>>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev>>>
>>>
>>
>> _______________________________________________
>> WebObjects-dev mailing list
>> email@hidden
>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev>>
>>
>
> _______________________________________________
> WebObjects-dev mailing list
> email@hidden
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
_______________________________________________
WebObjects-dev mailing list
email@hidden
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
===========End of original message text===========
_______________________________________________
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.