How can I stop repeat clicks

G

Guest

When the web page takes a while to process users get impatient and click the
button again. I need to throw these extra clicks away or disable the button
after the first click.
 
G

Guest

Still having a problem. I've converted the code to VB and have:

btnOkay.Attributes.Add("onclick", "javascript:document.getElementById('" _
& btnOkay.ClientID + "').disabled=true;" &
Page.GetPostBackEventReference(btnOkay))

On the Web page it's

<tr>
<TD align="center"><input type="image" name="btnOkay"
onclick="javascript:document.getElementById('btnOkay').disabled=true;__doPostBack('btnOkay','')if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnOkay" src="imgBtnOkay.gif" alt="Click to accept
the name as the signer." border="0" /></TD>
</tr>

Don't understand this code but it doesn't stop repeat clicks. Additional
HELP please!
 
G

Guest

Got it!

in Page_load
btnOkay.Attributes.Add("onclick", "javascript:document.getElementById('" _
& btnOkay.ClientID + "').disabled=true;" &
Page.GetPostBackEventReference(btnOkay) & ";")

which results in

<tr>
<TD align="center"><input type="image" name="btnOkay"
onclick="javascript:document.getElementById('btnOkay').disabled=true;__doPostBack('btnOkay','');if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnOkay" src="imgBtnOkay.gif" alt="Click to accept
the name as the signer." border="0" /></TD>
</tr>

I was missing a semi-colon.

Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top