[Javascript] disabling form on submit

Hugo Ahlenius Hugo.Ahlenius at grida.no
Tue May 25 03:56:15 CDT 2004


Excellent, this might be a winner!

The form elements are primarily input-text/checkbox/radio, textarea and
select.

Tack!


--
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
------------------------------------------------------------- 






| -----Original Message-----
| From: Hakan Magnusson [mailto:hakan at backbase.com]
| Sent: Tuesday, May 25, 2004 12:51
| To: [JavaScript List]
| Subject: Re: [Javascript] disabling form on submit
|
|
| Hugo Ahlenius wrote:
| > But the discussion gave me an idea: one could, on the
| submit event a)
| > create a bunch of hidden form elements duplicating the
| existing ones,
| > and b) then disable the non-hidden form elements.
|
| What kind of form elements are you using on the page? The
| attribute "readonly" will not affect the results of your
| post, so if you can set all elements to readonly you'll have
| a usable solution. When it comes to the "disabled" look,
| that's quite easily simulated through CSS.
|
|
| form.isEnabled input {   /* Normal look */
| 	border: 1px solid #000000;
| 	background: #ffffff;
| 	color: #000000;
| }
|
| form.isDisabled input {  /* Low contrast, "disabled" look */
| 	border: 1px solid #808080;
| 	background: #b0b0b0;
| 	color: #606060;
| }
|
| With some more work you'll be able to change the appearance
| of all form elements by just changing the class of your
| parent form. On submit, simply set all form elements to
| 'readonly' and change the class of the form, voila!
|
| Those form elements that do not support 'readonly' (you'll
| have to check it up yourself) could be disabled by simply
| setting the onfocus handler to blur itself again.
|
| Regards,
| H
| _______________________________________________
| Javascript mailing list
| Javascript at LaTech.edu
| https://lists.LaTech.edu/mailman/listinfo/javascript
|
|
###########################################

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