Connecting Tech Pros Worldwide Forums | Help | Site Map

Clear Button malfunction on HTML form generated by PHP

johnacooke@gmail.com
Guest
 
Posts: n/a
#1: Dec 11 '07
I have a HTML form that is generated in part by PHP. The action
attribute on the form tag calls itself, so that I can validate the
fields without using any other form of code like Javascript to
validate fields, etc.

All works well; fields like e-mail addresses are correctly validated
with one notable exception.

The <input type="reset" ... only works the first time the form is
called.

If there are any problems with the fields, causing the form to refresh
with advisory data, then the Clear button does not function.

I am unable to explain this. Has anyone spotted anything similar? Do
you know why? Is there a workaround?

Many thanks.

John

Rik Wasmus
Guest
 
Posts: n/a
#2: Dec 11 '07

re: Clear Button malfunction on HTML form generated by PHP


On Tue, 11 Dec 2007 14:32:31 +0100, <johnacooke@gmail.comwrote:
Quote:
I have a HTML form that is generated in part by PHP. The action
attribute on the form tag calls itself, so that I can validate the
fields without using any other form of code like Javascript to
validate fields, etc.
>
All works well; fields like e-mail addresses are correctly validated
with one notable exception.
>
The <input type="reset" ... only works the first time the form is
called.
>
If there are any problems with the fields, causing the form to refresh
with advisory data, then the Clear button does not function.
>
I am unable to explain this. Has anyone spotted anything similar? Do
you know why? Is there a workaround?
<input type="reset"doesn _not_ empty all the values, rather it resets
all form values to the one in the HTMl source.
<http://www.w3.org/TR/html4/interact/forms.html#reset-button>

So if you're kind enough to provide them with the previous values so
they'll only have to change the incorrect one, those will be set. If you
want a 'clear' button instead of a 'reset' button, you'll either have to
use some javascript to do that, or make it a submit button and return a
crisp form to the user on that post value.
--
Rik Wasmus
Closed Thread