You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Dean, Michael" <Mi...@courts.wa.gov> on 2006/09/14 23:39:57 UTC

struts issue...

Interesting problem...

 

I have a submit button which includes a property = "method" with
value="Save"...the enclosing form is submitted to a Struts
DispatchAction sub-class which is configured to rely on the "method"
parameter for delegation. 

 

 In order to prevent a double-submit, in my onSubmit() javascript I
disable the button and immediately thereafter "return true"....however,
I proved that the disabling of the button prevents the required method
parameter from being included in the request...

 

I thought about a hidden field but I also established that they ARE NOT
added to the request upon submission...

 

Any ideas?

 

Michael Dean

Senior Java Programmer

JIS Applications Maintenance

Information Services Division

Administrative Office of the Courts

360.704.4008

Michael.Dean@courts.wa.gov

 


Re: struts issue...

Posted by Michael Jouravlev <jm...@gmail.com>.
Disabled input elements of an HTML form are not submitted. Use HTTP
sniffer to see what is submitted and what not.

On 9/14/06, Dean, Michael <Mi...@courts.wa.gov> wrote:
> Interesting problem...
>
>
>
> I have a submit button which includes a property = "method" with
> value="Save"...the enclosing form is submitted to a Struts
> DispatchAction sub-class which is configured to rely on the "method"
> parameter for delegation.
>
>
>
>  In order to prevent a double-submit, in my onSubmit() javascript I
> disable the button and immediately thereafter "return true"....however,
> I proved that the disabling of the button prevents the required method
> parameter from being included in the request...
>
>
>
> I thought about a hidden field but I also established that they ARE NOT
> added to the request upon submission...
>
>
>
> Any ideas?
>
>
>
> Michael Dean
>
> Senior Java Programmer
>
> JIS Applications Maintenance
>
> Information Services Division
>
> Administrative Office of the Courts
>
> 360.704.4008
>
> Michael.Dean@courts.wa.gov
>
>
>
>
>

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


Re: struts issue...

Posted by Puneet Lakhina <pu...@gmail.com>.
On 9/15/06, Dean, Michael <Mi...@courts.wa.gov> wrote:
>
> Interesting problem...
>
>
>
> I have a submit button which includes a property = "method" with
> value="Save"...the enclosing form is submitted to a Struts
> DispatchAction sub-class which is configured to rely on the "method"
> parameter for delegation.
>
>
>
> In order to prevent a double-submit, in my onSubmit() javascript I
> disable the button and immediately thereafter "return true"....however,
> I proved that the disabling of the button prevents the required method
> parameter from being included in the request...


True. Anything that is disabled in HTML is not submitted in the request.
This is how HTML works and has nothing to do with struts.

I thought about a hidden field but I also established that they ARE NOT
> added to the request upon submission...


How did you arrive at this conclusion. You might be doing something wrong.
Because hidden fields are supposed to be and ARE added to the request,
infact they dont really make sense if they are not added.

Any ideas?


Post your code,and then maybe someone can suggest an approach.

Michael Dean
>
> Senior Java Programmer
>
> JIS Applications Maintenance
>
> Information Services Division
>
> Administrative Office of the Courts
>
> 360.704.4008
>
> Michael.Dean@courts.wa.gov
>
>
>
>
>


-- 
Puneet

Re: struts issue...

Posted by Matts <ma...@hotmail.com>.
here's de code I use to disable de button and do submit. May be you can use 
it.

<script type="text/javascript" >

function doSubmit(button){

button.disabled=true;

button.form.submit();

}

</script>

<html:hidden property="method" value="Agregar"/>

<html:submit property="method" value="anyName" onclick="doSubmit(this);"/>





----- Original Message ----- 
From: "Puneet Lakhina" <pu...@gmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, September 15, 2006 8:13 AM
Subject: Re: struts issue...


> On 9/15/06, Dean, Michael <Mi...@courts.wa.gov> wrote:
>>
>> Interesting problem...
>>
>>
>>
>> I have a submit button which includes a property = "method" with
>> value="Save"...the enclosing form is submitted to a Struts
>> DispatchAction sub-class which is configured to rely on the "method"
>> parameter for delegation.
>>
>>
>>
>> In order to prevent a double-submit, in my onSubmit() javascript I
>> disable the button and immediately thereafter "return true"....however,
>> I proved that the disabling of the button prevents the required method
>> parameter from being included in the request...
>>
>>
>>
>> I thought about a hidden field but I also established that they ARE NOT
>> added to the request upon submission...
>>
>>
>>
>> Any ideas?
>
>
> Ok this is something you could try
> <script>
> var submitnow = true;
> function onSubmitFunction () {
> if(submitnow = true) {
>    submitnow = false;
>     return true;
> }else {
>       return false;
> }
> }
> </script>
>
> Not sure if this will work. Because I havent tried it.
>
>> Michael Dean
>>
>> Senior Java Programmer
>>
>> JIS Applications Maintenance
>>
>> Information Services Division
>>
>> Administrative Office of the Courts
>>
>> 360.704.4008
>>
>> Michael.Dean@courts.wa.gov
>>
>>
>>
>>
>>
>
>
> -- 
> Puneet
> 


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


Re: struts issue...

Posted by Martin Gainty <mg...@hotmail.com>.
Michael-
Its sounds as if you have (at least) 2 possible submits most probably by the submit button as well as the form action parameter
you have can solve using one of 2 solutions 
1)
either disable submit calling the function OR disable form action calling the function
2)
have both submit and action call a javascript function (which handles validation and then forwards to the proper location)

HTH,
Martin --
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Asthana, Rahul" <Ra...@CIBC.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, September 15, 2006 11:23 AM
Subject: RE: struts issue...


The code posted by punit works.The only problem is that suppose the user clicks on submit and for some reason stops the form from submitting through the browser controls(it happened with me, some users did it apparently because it was taking a long time), then the form would never be submitted again.

-----Original Message-----
From: Puneet Lakhina [mailto:puneet.lakhina@gmail.com]
Sent: Friday, September 15, 2006 7:14 AM
To: Struts Users Mailing List
Subject: Re: struts issue...


On 9/15/06, Dean, Michael <Mi...@courts.wa.gov> wrote:
>
> Interesting problem...
>
>
>
> I have a submit button which includes a property = "method" with
> value="Save"...the enclosing form is submitted to a Struts
> DispatchAction sub-class which is configured to rely on the "method"
> parameter for delegation.
>
>
>
> In order to prevent a double-submit, in my onSubmit() javascript I
> disable the button and immediately thereafter "return true"....however,
> I proved that the disabling of the button prevents the required method
> parameter from being included in the request...
>
>
>
> I thought about a hidden field but I also established that they ARE NOT
> added to the request upon submission...
>
>
>
> Any ideas?


Ok this is something you could try
<script>
var submitnow = true;
function onSubmitFunction () {
if(submitnow = true) {
    submitnow = false;
     return true;
}else {
       return false;
}
}
</script>

Not sure if this will work. Because I havent tried it.

> Michael Dean
>
> Senior Java Programmer
>
> JIS Applications Maintenance
>
> Information Services Division
>
> Administrative Office of the Courts
>
> 360.704.4008
>
> Michael.Dean@courts.wa.gov
>
>
>
>
>


-- 
Puneet

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


RE: struts issue...

Posted by "Asthana, Rahul" <Ra...@CIBC.com>.
The code posted by punit works.The only problem is that suppose the user clicks on submit and for some reason stops the form from submitting through the browser controls(it happened with me, some users did it apparently because it was taking a long time), then the form would never be submitted again.

-----Original Message-----
From: Puneet Lakhina [mailto:puneet.lakhina@gmail.com]
Sent: Friday, September 15, 2006 7:14 AM
To: Struts Users Mailing List
Subject: Re: struts issue...


On 9/15/06, Dean, Michael <Mi...@courts.wa.gov> wrote:
>
> Interesting problem...
>
>
>
> I have a submit button which includes a property = "method" with
> value="Save"...the enclosing form is submitted to a Struts
> DispatchAction sub-class which is configured to rely on the "method"
> parameter for delegation.
>
>
>
> In order to prevent a double-submit, in my onSubmit() javascript I
> disable the button and immediately thereafter "return true"....however,
> I proved that the disabling of the button prevents the required method
> parameter from being included in the request...
>
>
>
> I thought about a hidden field but I also established that they ARE NOT
> added to the request upon submission...
>
>
>
> Any ideas?


Ok this is something you could try
<script>
var submitnow = true;
function onSubmitFunction () {
if(submitnow = true) {
    submitnow = false;
     return true;
}else {
       return false;
}
}
</script>

Not sure if this will work. Because I havent tried it.

> Michael Dean
>
> Senior Java Programmer
>
> JIS Applications Maintenance
>
> Information Services Division
>
> Administrative Office of the Courts
>
> 360.704.4008
>
> Michael.Dean@courts.wa.gov
>
>
>
>
>


-- 
Puneet

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


Re: struts issue...

Posted by Puneet Lakhina <pu...@gmail.com>.
On 9/15/06, Dean, Michael <Mi...@courts.wa.gov> wrote:
>
> Interesting problem...
>
>
>
> I have a submit button which includes a property = "method" with
> value="Save"...the enclosing form is submitted to a Struts
> DispatchAction sub-class which is configured to rely on the "method"
> parameter for delegation.
>
>
>
> In order to prevent a double-submit, in my onSubmit() javascript I
> disable the button and immediately thereafter "return true"....however,
> I proved that the disabling of the button prevents the required method
> parameter from being included in the request...
>
>
>
> I thought about a hidden field but I also established that they ARE NOT
> added to the request upon submission...
>
>
>
> Any ideas?


Ok this is something you could try
<script>
var submitnow = true;
function onSubmitFunction () {
if(submitnow = true) {
    submitnow = false;
     return true;
}else {
       return false;
}
}
</script>

Not sure if this will work. Because I havent tried it.

> Michael Dean
>
> Senior Java Programmer
>
> JIS Applications Maintenance
>
> Information Services Division
>
> Administrative Office of the Courts
>
> 360.704.4008
>
> Michael.Dean@courts.wa.gov
>
>
>
>
>


-- 
Puneet