Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - How to disable submit button?
  
User name:
Password:
Reply:
 

UserPost
Mercury
Posts: 41/88
Yeah, my mistake, I made a little syntax error .
Thanks !
Modereb
Posts: 73/75
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;">.
Black Lord
Posts: 79/453
i just tested it and it seemed to work fine for mercury... maybe a little slip in your form's code or something...
Mercury
Posts: 39/88
Thanks for the fast reply .

it works, but now the form doesn't get processed?
Modereb
Posts: 72/75

<input type="button" onclick="this.disabled=1;" value="Test button" />

Mercury
Posts: 38/88
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:


<script language=JavaScript>
function disable() {
document.replier.submit.disabled = true;
return true;
}
</script>



Then is a part of my form:
<form action=test.php name=replier method=post onsubmit=\"return disable()\">

and

<input type=submit class=submit name=submit value=\"test\">

But it doesn't work, any ideas?
Acmlm's Board - I2 Archive - Programming - How to disable submit button?


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.011 seconds.