You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by hari_s <ha...@indonesian-aerospace.com> on 2003/12/04 02:26:05 UTC

how to disabled submit button from action class

Hi all.
Is there a way to disabled submit button from action? 
Any examples will be considered.
Thank you, 

Re: how to disabled submit button from action class

Posted by Max Cooper <ma...@maxcooper.com>.
The submit button exists on the client. The Action code executes on the
server. Action code cannot reach out and disable a submit button on the
client.

However, you can have the Action decide in advance that the page the browser
will render has its submit button disabled. Consider an ActionForm with a
"submitButtonDisabled" property. The Action could set it to true, and then
the JSP could render the button accordingly. When the browser renders the
plain old HTML produced when the server executes the JSP, it will render the
button as disabled.

If you want this to work more dynamically, perhaps disabling the button
after the user clicks it once, you will need to use something that executes
on the client. JavaScript, for instance. Tokens can also be used to handle
the "user double-clicked the submit button" problem. Struts has token
support built-in. Sometimes, a number of techniques (JavaScript and tokens)
need to be combined to produce the exact behavior desired (or as close as
you can get to it).

This general topic is discussed quite frequently on this list, so it might
be worth searching the mail archive.

-Max

----- Original Message ----- 
From: "hari_s" <ha...@indonesian-aerospace.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, December 03, 2003 5:26 PM
Subject: how to disabled submit button from action class


> Hi all.
> Is there a way to disabled submit button from action?
> Any examples will be considered.
> Thank you,
>



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


Re: how to disabled submit button from action class

Posted by Kevin Hagel <kh...@mminternet.com>.
http://jakarta.apache.org/struts/userGuide/struts-html.html#submit

disabled="true"

or
disabled="${disabledSetting}"

something like that.

----- Original Message ----- 
From: "hari_s" <ha...@indonesian-aerospace.com>
To: <st...@jakarta.apache.org>
Sent: Wednesday, December 03, 2003 5:26 PM
Subject: how to disabled submit button from action class


> Hi all.
> Is there a way to disabled submit button from action? 
> Any examples will be considered.
> Thank you, 
> 

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