You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Judy Spengeman <sp...@hotmail.com> on 2003/11/13 23:27:38 UTC

Struts - sometime the form is being submitted twice

Using the following code fragment:
function f_ValidateForm(later) {


var newline = unescape("%0A");

var leading_space = "";

var ni = newline + leading_space; ........

} // end with


if (later == 1)

{

document.formq1.BUTTONPRESSED.value = "FinishLater";

document.formq1.submit();

}

else

if (later == 0)

{

document.formq1.BUTTONPRESSED.value = "NextPage";

}

return true; }


<FORM ... action="/SampleApp/questionnaire.do">

<INPUT type="button" name="FinishLater" value="Save and finish later" 
onClick="return f_ValidateForm(1)">

<INPUT type="submit" name="NextPage" value="Continue" onClick="return 
f_ValidateForm(0)">

--------------------------------------------------------

Prior to moving the questionnairre Servlet\JSP to implementing a Struts 
Action class, the form was being submitted to the servlet without any 
problem. Now all of a sudden (on rare instance), the form is sometimes being 
submitted twice - returning with a error due to a duplicate table entry.

Can anyone determine the cause of this (besides the "FinishLater" submitting 
the form and then returning true to the button)? Is this something within 
Struts? Why has this cropped up only now as this code has been in production 
for quite a while with the 'submit/return true'??? Is it WebSphere 5.0? 
Struts?

Please help!!!

_________________________________________________________________
MSN Messenger with backgrounds, emoticons and more. 
http://www.msnmessenger-download.com/tracking/cdp_customize


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Struts - sometime the form is being submitted twice

Posted by Vic Cekvenich <ce...@baseBeans.com>.
Read up on Tokens in the Action class. It explains how to eliminate this 
( that would have also happened even in a regular non struts servlet/jsp).

hth,

.V
Judy Spengeman wrote:

> Using the following code fragment:
> function f_ValidateForm(later) {
> 
> 
> var newline = unescape("%0A");
> 
> var leading_space = "";
> 
> var ni = newline + leading_space; ........
> 
> } // end with
> 
> 
> if (later == 1)
> 
> {
> 
> document.formq1.BUTTONPRESSED.value = "FinishLater";
> 
> document.formq1.submit();
> 
> }
> 
> else
> 
> if (later == 0)
> 
> {
> 
> document.formq1.BUTTONPRESSED.value = "NextPage";
> 
> }
> 
> return true; }
> 
> 
> <FORM ... action="/SampleApp/questionnaire.do">
> 
> <INPUT type="button" name="FinishLater" value="Save and finish later" 
> onClick="return f_ValidateForm(1)">
> 
> <INPUT type="submit" name="NextPage" value="Continue" onClick="return 
> f_ValidateForm(0)">
> 
> --------------------------------------------------------
> 
> Prior to moving the questionnairre Servlet\JSP to implementing a Struts 
> Action class, the form was being submitted to the servlet without any 
> problem. Now all of a sudden (on rare instance), the form is sometimes 
> being submitted twice - returning with a error due to a duplicate table 
> entry.
> 
> Can anyone determine the cause of this (besides the "FinishLater" 
> submitting the form and then returning true to the button)? Is this 
> something within Struts? Why has this cropped up only now as this code 
> has been in production for quite a while with the 'submit/return 
> true'??? Is it WebSphere 5.0? Struts?
> 
> Please help!!!
> 
> _________________________________________________________________
> MSN Messenger with backgrounds, emoticons and more. 
> http://www.msnmessenger-download.com/tracking/cdp_customize




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org