|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Disable Submit ButtonHi,
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 jack-e wrote:
> Hi, Use the Attributes collection to set the onclick to disabled the button > > 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 > 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 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 Eliyahu Goldin wrote:
Show quoteHide quote > Much shorter form: Hmmm, that didn't seem to work for me. Could you provide sample code if > > 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 > > > so? For completeness here.... -- Craig Deelsnyder Microsoft MVP - ASP/ASP.NET 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 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 > > 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
databind - XmlNodeList to DropDownList
custom web controls and conversion to inline code DataGrid NOT Paging No Frames?? how to get client cpu id A program about get value from datagrid cell Programmatically changing CssStyle on Panels depending on DB values PHP guy turned ASP needs pointers Urgent Problem with CustomValidator |
|||||||||||||||||||||||