[Javascript] disabling form on submit

Hugo Ahlenius Hugo.Ahlenius at grida.no
Mon May 24 11:52:59 CDT 2004


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/




More information about the Javascript mailing list