Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - How to disable submit button? | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Mercury Shyguy Level: 16 Posts: 38/88 EXP: 18132 For next: 2124 Since: 07-08-04 From: Hihihi. Since last post: 1 day Last activity: 1 day |
| ||
Hey, what I want is after you click a submit (form) button, that submit button gets disabled, so you can't click it again. This is extremely helpful with browser games for example. I know it's possible, I've seen it on another site. On that site, the button turns grey after clicking it once. I've looked around, but didn't really find something. I've also looked at the source of that site, but couldn't really find something, except this: < function disable() { document.replier.submit.disabled = true; return true; } < Then is a part of my form: < and < But it doesn't work, any ideas? (edited by Mercury on 11-04-04 12:50 PM) (edited by Mercury on 11-04-04 12:50 PM) (edited by Mercury on 11-04-04 12:50 PM) |
|||
Modereb Paragoomba Level: 15 Posts: 72/75 EXP: 14749 For next: 1635 Since: 06-04-04 Since last post: 350 days Last activity: 339 days |
| ||
<input type="button" onclick="this.disabled=1;" value="Test button" /> |
|||
Mercury Shyguy Level: 16 Posts: 39/88 EXP: 18132 For next: 2124 Since: 07-08-04 From: Hihihi. Since last post: 1 day Last activity: 1 day |
| ||
Thanks for the fast reply . it works, but now the form doesn't get processed? |
|||
Black Lord Level: 34 Posts: 79/453 EXP: 235639 For next: 18012 Since: 03-15-04 From: Nebraska, what's a Nebraska Since last post: 8 days Last activity: 1 day |
| ||
i just tested it and it seemed to work fine for mercury... maybe a little slip in your form's code or something... | |||
Modereb Paragoomba Level: 15 Posts: 73/75 EXP: 14749 For next: 1635 Since: 06-04-04 Since last post: 350 days Last activity: 339 days |
| ||
My example above is a button type input, but it should just submit normally if you use the onclick code in a submit type input. So, in other words, <input type="submit" /> instead of <input type="button" />. Another way is to put it in the <form> tag's onsubmit attribute: <form onsubmit="form.button_that_needs_to_be_disabled.disabled=1;">. |
|||
Mercury Shyguy Level: 16 Posts: 41/88 EXP: 18132 For next: 2124 Since: 07-08-04 From: Hihihi. Since last post: 1 day Last activity: 1 day |
| ||
Yeah, my mistake, I made a little syntax error . Thanks ! |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - How to disable submit button? | | | |