Home All Groups Group Topic Archive Search About
Author
20 Jun 2005 1:26 AM
jack-e
Hi,

Can someone please provide me with an example of how to disable the
submit button once clicked (using javascript i guess). Keep in mind I
also have to invoke a server side function which processes the form.

Thanks in advance.

Jack

Author
20 Jun 2005 2:07 AM
Craig Deelsnyder
jack-e wrote:
> Hi,
>
> Can someone please provide me with an example of how to disable the
> submit button once clicked (using javascript i guess). Keep in mind I
> also have to invoke a server side function which processes the form.
>
> Thanks in advance.
>
> Jack
>

Use the Attributes collection to set the onclick to disabled the button
and submit normally:

button1.Attributes.Add("onclick","javascript:document.getElementById('"
+ button1.ClientID + "').disabled=true;" +
this.GetPostBackEventReference(button1));

reference:

http://www.codeproject.com/useritems/DisableSubmitButton.asp

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Author
20 Jun 2005 10:19 AM
Eliyahu Goldin
Much shorter form:

button1.Attributes.Add("onclick","this.disabled=true;return true;");

Eliyahu

Show quoteHide quote
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:esLzkzTdFHA.1036@tk2msftngp13.phx.gbl...
> jack-e wrote:
> > Hi,
> >
> > Can someone please provide me with an example of how to disable the
> > submit button once clicked (using javascript i guess). Keep in mind I
> > also have to invoke a server side function which processes the form.
> >
> > Thanks in advance.
> >
> > Jack
> >
>
> Use the Attributes collection to set the onclick to disabled the button
> and submit normally:
>
> button1.Attributes.Add("onclick","javascript:document.getElementById('"
> + button1.ClientID + "').disabled=true;" +
> this.GetPostBackEventReference(button1));
>
> reference:
>
> http://www.codeproject.com/useritems/DisableSubmitButton.asp
>
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET
Author
20 Jun 2005 2:37 PM
Craig Deelsnyder
Eliyahu Goldin wrote:
Show quoteHide quote
> Much shorter form:
>
> button1.Attributes.Add("onclick","this.disabled=true;return true;");
>
> Eliyahu
>
> "Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
> news:esLzkzTdFHA.1036@tk2msftngp13.phx.gbl...
>
>>jack-e wrote:
>>
>>>Hi,
>>>
>>>Can someone please provide me with an example of how to disable the
>>>submit button once clicked (using javascript i guess). Keep in mind I
>>>also have to invoke a server side function which processes the form.
>>>
>>>Thanks in advance.
>>>
>>>Jack
>>>
>>
>>Use the Attributes collection to set the onclick to disabled the button
>>and submit normally:
>>
>>button1.Attributes.Add("onclick","javascript:document.getElementById('"
>>+ button1.ClientID + "').disabled=true;" +
>>this.GetPostBackEventReference(button1));
>>
>>reference:
>>
>>http://www.codeproject.com/useritems/DisableSubmitButton.asp
>>
>>--
>>Craig Deelsnyder
>>Microsoft MVP - ASP/ASP.NET
>
>
>

Hmmm, that didn't seem to work for me.  Could you provide sample code if
so?  For completeness here....

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Author
20 Jun 2005 2:51 PM
Patrice
Try to submit the from and then to disable the button. If you disable first
the button, the button is not considered pressed (disabled control are not
posted).

Patrice

--

Show quoteHide quote
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> a écrit dans le message
de news:%23Zsg4VadFHA.3932@TK2MSFTNGP12.phx.gbl...
> Eliyahu Goldin wrote:
> > Much shorter form:
> >
> > button1.Attributes.Add("onclick","this.disabled=true;return true;");
> >
> > Eliyahu
> >
> > "Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
> > news:esLzkzTdFHA.1036@tk2msftngp13.phx.gbl...
> >
> >>jack-e wrote:
> >>
> >>>Hi,
> >>>
> >>>Can someone please provide me with an example of how to disable the
> >>>submit button once clicked (using javascript i guess). Keep in mind I
> >>>also have to invoke a server side function which processes the form.
> >>>
> >>>Thanks in advance.
> >>>
> >>>Jack
> >>>
> >>
> >>Use the Attributes collection to set the onclick to disabled the button
> >>and submit normally:
> >>
> >>button1.Attributes.Add("onclick","javascript:document.getElementById('"
> >>+ button1.ClientID + "').disabled=true;" +
> >>this.GetPostBackEventReference(button1));
> >>
> >>reference:
> >>
> >>http://www.codeproject.com/useritems/DisableSubmitButton.asp
> >>
> >>--
> >>Craig Deelsnyder
> >>Microsoft MVP - ASP/ASP.NET
> >
> >
> >
>
> Hmmm, that didn't seem to work for me.  Could you provide sample code if
> so?  For completeness here....
>
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET
Author
20 Jun 2005 4:02 PM
Eliyahu Goldin
Could be. This I didn't check. I've just optimized the size of the code.

Eliyahu

Show quoteHide quote
"Patrice" <nob***@nowhere.com> wrote in message
news:eFj%23VeadFHA.2124@TK2MSFTNGP14.phx.gbl...
> Try to submit the from and then to disable the button. If you disable
first
> the button, the button is not considered pressed (disabled control are not
> posted).
>
> Patrice
>
> --
>
> "Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> a écrit dans le
message
> de news:%23Zsg4VadFHA.3932@TK2MSFTNGP12.phx.gbl...
> > Eliyahu Goldin wrote:
> > > Much shorter form:
> > >
> > > button1.Attributes.Add("onclick","this.disabled=true;return true;");
> > >
> > > Eliyahu
> > >
> > > "Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
> > > news:esLzkzTdFHA.1036@tk2msftngp13.phx.gbl...
> > >
> > >>jack-e wrote:
> > >>
> > >>>Hi,
> > >>>
> > >>>Can someone please provide me with an example of how to disable the
> > >>>submit button once clicked (using javascript i guess). Keep in mind I
> > >>>also have to invoke a server side function which processes the form.
> > >>>
> > >>>Thanks in advance.
> > >>>
> > >>>Jack
> > >>>
> > >>
> > >>Use the Attributes collection to set the onclick to disabled the
button
> > >>and submit normally:
> > >>
> >
>>button1.Attributes.Add("onclick","javascript:document.getElementById('"
> > >>+ button1.ClientID + "').disabled=true;" +
> > >>this.GetPostBackEventReference(button1));
> > >>
> > >>reference:
> > >>
> > >>http://www.codeproject.com/useritems/DisableSubmitButton.asp
> > >>
> > >>--
> > >>Craig Deelsnyder
> > >>Microsoft MVP - ASP/ASP.NET
> > >
> > >
> > >
> >
> > Hmmm, that didn't seem to work for me.  Could you provide sample code if
> > so?  For completeness here....
> >
> > --
> > Craig Deelsnyder
> > Microsoft MVP - ASP/ASP.NET
>
>
Author
20 Jun 2005 3:59 PM
Eliyahu Goldin
Craig,

You can check it on any server-side button. "this" is the client-side
reference to the button itself and "return true" takes care about bubbling
the event up.

Eliyahu

Show quoteHide quote
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:%23Zsg4VadFHA.3932@TK2MSFTNGP12.phx.gbl...
> Eliyahu Goldin wrote:
> > Much shorter form:
> >
> > button1.Attributes.Add("onclick","this.disabled=true;return true;");
> >
> > Eliyahu
> >
> > "Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
> > news:esLzkzTdFHA.1036@tk2msftngp13.phx.gbl...
> >
> >>jack-e wrote:
> >>
> >>>Hi,
> >>>
> >>>Can someone please provide me with an example of how to disable the
> >>>submit button once clicked (using javascript i guess). Keep in mind I
> >>>also have to invoke a server side function which processes the form.
> >>>
> >>>Thanks in advance.
> >>>
> >>>Jack
> >>>
> >>
> >>Use the Attributes collection to set the onclick to disabled the button
> >>and submit normally:
> >>
> >>button1.Attributes.Add("onclick","javascript:document.getElementById('"
> >>+ button1.ClientID + "').disabled=true;" +
> >>this.GetPostBackEventReference(button1));
> >>
> >>reference:
> >>
> >>http://www.codeproject.com/useritems/DisableSubmitButton.asp
> >>
> >>--
> >>Craig Deelsnyder
> >>Microsoft MVP - ASP/ASP.NET
> >
> >
> >
>
> Hmmm, that didn't seem to work for me.  Could you provide sample code if
> so?  For completeness here....
>
> --
> Craig Deelsnyder
> Microsoft MVP - ASP/ASP.NET