Closed Thread Icon

Topic awaiting preservation: Disabling a button (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=9036" title="Pages that link to Topic awaiting preservation: Disabling a button (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Disabling a button <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 02-27-2004 15:25

Greets!

I'm trying to make a submit button disabled after clicking to avoid resubmitting a form.

code:
<input type="submit" name="button" value="Check" onclick="this.value='Please wait'; button.disabled=true; return true;">



Is what I'm using. It does disable the button after clicking, but doesn't submit the form. What's up with that?

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 02-27-2004 16:10

It doesn't seem like that should cause a problem. If the sole issue is that disabling the button before the onclick event is finished cancels the form submission, then you have two possibilities:

1. put the button disabling code in the form's onsubmit event (probably the best choice)
2. call this.form.submit() before disabling the button

« BackwardsOnwards »

Show Forum Drop Down Menu