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? | |
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
Posted on 11-04-04 09:47 PM Link | Quote
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?


(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
Posted on 11-04-04 09:54 PM Link | Quote

<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
Posted on 11-04-04 09:58 PM Link | Quote
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
Posted on 11-05-04 02:42 AM Link | Quote
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
Posted on 11-05-04 02:59 AM Link | Quote
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
Posted on 11-05-04 07:52 PM Link | Quote
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? | |


ABII


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



Page rendered in 0.011 seconds.