[Javascript] disabling form on submit
Shawn Milo
milo at linuxmail.org
Mon May 24 12:39:17 CDT 2004
Here's an (untested) idea.
Onsubmit, if the value of the submit
button == 'Please Wait', return false.
Onsubmit, change the value of the
submit button to "Please Wait".
Shawn
----- Original Message -----
From: "Hugo Ahlenius" <Hugo.Ahlenius at grida.no>
Date: Mon, 24 May 2004 18:52:59 +0200
To: <javascript at LaTech.edu>
Subject: [Javascript] disabling form on submit
Hi,
I have a little issue, I am trying to create a javascript file that I
can easily include on web pages.
My idea is to have an include that disables all the form elements on
submit of the form (to signal that it is processing, and to prevent the
user from pressing the submit button multiple times).
My problem is that if the form elements are disabled before the
submit, then they are not sent to the action Url (expected behaviour).
If I use the onsubmit event on the form and set it to "this.submit();
doDisable(); return false;", then it works fine. But no I want to take
this a step further and avoid adding code to that event, rather have the
javascript attach that event to all forms.
And that is where the headache starts. I am not sure how to
addEventListener/attachEvent to ensure that the disabling is happing
after the submission...
Any input/tips... ?
--
Hugo Ahlenius
-------------------------------------------------------------
Hugo Ahlenius E-Mail: hugo.ahlenius at grida.no
Project Officer Phone: +46 8 230460
UNEP GRID-Arendal Fax: +46 8 230441
Stockholm Office Mobile: +46 733 467111
WWW: http://www.grida.no
-------------------------------------------------------------
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft
Exchange.
For more information, connect to http://www.F-Secure.com/
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list