Connecting Tech Pros Worldwide Forums | Help | Site Map

Disable a button on first click

Stuart Quinn
Guest
 
Posts: n/a
#1: Aug 5 '06
Is there a way to disable a button to disallow a user to click on it more
than once?

Thanks!



Kumar Reddi
Guest
 
Posts: n/a
#2: Aug 5 '06

re: Disable a button on first click


try using the oneClick control from Metabuilders

http://www.metabuilders.com/Tools/OneClick.aspx

"Stuart Quinn" <nospamplease@yahoo.comwrote in message
news:aS7Bg.410$Nt2.138@tornado.rdc-kc.rr.com...
Quote:
Is there a way to disable a button to disallow a user to click on it more
than once?
>
Thanks!
>
>

Scott M.
Guest
 
Posts: n/a
#3: Aug 5 '06

re: Disable a button on first click


Add client-side javascript: onClick="nameOfButton.enabled=false"


"Kumar Reddi" <kumarreddi@gmail.comwrote in message
news:uF$A2oNuGHA.2448@TK2MSFTNGP06.phx.gbl...
Quote:
try using the oneClick control from Metabuilders
>
http://www.metabuilders.com/Tools/OneClick.aspx
>
"Stuart Quinn" <nospamplease@yahoo.comwrote in message
news:aS7Bg.410$Nt2.138@tornado.rdc-kc.rr.com...
Quote:
>Is there a way to disable a button to disallow a user to click on it more
>than once?
>>
>Thanks!
>>
>>
>
>

jmnobre
Guest
 
Posts: n/a
#4: Aug 6 '06

re: Disable a button on first click


The solution maily depends on your client's browser capabilities...
If you can ensure that javascript is enabled, then you can add the
following script:

C#:
yourButton.Attributes.Add( "onClick='yourButton.enabled=false;'");

The problem is if your site is public and you cannot ensure that your
clients all have javascript enabled!
In that case, you can only rely on server side code, and you have to
ensure that if 2 posts came from the same client, all but the 1st will
be ignored!



Stuart Quinn wrote:
Quote:
Is there a way to disable a button to disallow a user to click on it more
than once?
>
Thanks!
Riki
Guest
 
Posts: n/a
#5: Aug 6 '06

re: Disable a button on first click


jmnobre wrote:
Quote:
The solution maily depends on your client's browser capabilities...
If you can ensure that javascript is enabled, then you can add the
following script:
>
C#:
yourButton.Attributes.Add( "onClick='yourButton.enabled=false;'");
>
The problem is if your site is public and you cannot ensure that your
clients all have javascript enabled!
In that case, you can only rely on server side code, and you have to
ensure that if 2 posts came from the same client, all but the 1st will
be ignored!
>
>
>
Stuart Quinn wrote:
Quote:
>Is there a way to disable a button to disallow a user to click on it
>more than once?
>>
>Thanks!
If you also want to disable pressing the Enter key twice, you need
to move the script to the onSubmit event of the form.

Some of the caveats are discussed in a part of this article:
http://msdn.microsoft.com/msdnmag/is...efault.aspx#S3

--

Riki


Edwin Knoppert
Guest
 
Posts: n/a
#6: Aug 6 '06

re: Disable a button on first click


I guess this.enabled = false; will do as well.
(should) save the trouble of obtaining the clientid


"Scott M." <s-mar@nospam.nospamschreef in bericht
news:eazayuNuGHA.5056@TK2MSFTNGP06.phx.gbl...
Quote:
Add client-side javascript: onClick="nameOfButton.enabled=false"
>
>
"Kumar Reddi" <kumarreddi@gmail.comwrote in message
news:uF$A2oNuGHA.2448@TK2MSFTNGP06.phx.gbl...
Quote:
>try using the oneClick control from Metabuilders
>>
>http://www.metabuilders.com/Tools/OneClick.aspx
>>
>"Stuart Quinn" <nospamplease@yahoo.comwrote in message
>news:aS7Bg.410$Nt2.138@tornado.rdc-kc.rr.com...
Quote:
>>Is there a way to disable a button to disallow a user to click on it
>>more than once?
>>>
>>Thanks!
>>>
>>>
>>
>>
>
>

daniel@withsolutions.com
Guest
 
Posts: n/a
#7: Aug 7 '06

re: Disable a button on first click


This will stop multiple submits.
I got this from this newsgroup and always
wanted to thank the author but could not locate the post..


--aspx code--
<script type="text/javascript">
var submitFlag = false;
</script>
--end code--

--Page Load code--
Submit.Attributes.Add("onclick", "javascript:if(submitFlag){return
false;}else{submitFlag=true;return true;}")
--end code--

Closed Thread