[Javascript] disabling form on submit

Tim Makins spindrift at oceanfree.net
Mon May 24 12:08:40 CDT 2004


Hmmm, sounds complicated. Why not have a variable set to 1, that is
incremented each time the 'submit' button is pressed, and sent as a hidden
value to your script ?

Tim in Ireland.


----- Original Message ----- 
From: "Hugo Ahlenius" <Hugo.Ahlenius at grida.no>
To: <javascript at LaTech.edu>
Sent: Monday, May 24, 2004 5:52 PM
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