[Javascript] disabling form on submit

Roberts, Mark (Tulsa) Mark.Roberts at Williams.com
Mon May 24 12:03:37 CDT 2004


Apparently this might be hard to do as so many people seem to have a
problem with it.

My initial thought would be to change the submit/button control to
execute a JS function. The first would be to disable the button followed
by a form.submit() command.

-----Original Message-----
From: Hugo Ahlenius [mailto:Hugo.Ahlenius at grida.no] 
Sent: Monday, May 24, 2004 11:53 AM
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