How to disable a form on submit?

B

Bogdan

Hi,

I'd like to disable the whole form on the client side right after it is
submitted. There are many controls that could trigger the submit so I'd
like to stay away from disabling each of them individually.

In the past I used to disable individual buttons (with a delay to avoid
'known' problems with events not being raised by disabled buttons). I'd
like to use a similar technique with the form although I'm not sure if this
is necessary. Could someone provide answers to the following questions?

1) If I disable a form on the client side just before it gets submitted will
the asp.net handle it the same way as if it were enabled?
2) What is the best place to plug-in my form disable script? For example,
how should I register the following script in an aspx page?
function disableForm() {
document.getElementById("aspnetForm").disabled = true;
}

Thanks,
Bogdan
 
N

Nanda Lella[MSFT]

You can just walk through and disable all the submit buttons as you were
doing before, or just use a hidden flag that disables any subsequent post
backs.

I have posted a blog post with an example implementation here
http://ctrlf5.net/?p=32.

Hope this helps,
--

Thank You,
Nanda Lella,
http://www.ctrlf5.net

This Posting is provided "AS IS" with no warranties, and confers no rights.
 

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,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top