Re: can't reset a hidden field in form
- From: RobG <rgqld@xxxxxxxxxxxx>
- Date: Mon, 13 Aug 2007 02:00:45 -0700
Evertjan. wrote:
RobG wrote on 13 aug 2007 in comp.lang.javascript:
I think IE7 and Safari3.0 are in error, logically speaking.
Technically it is a question of specification.
Personally, I think IE7 and Safari are right. The user tells the browser
"Reset this form" and that is what the browser does. FF and Opera don't
do what the user asked it to do.
I think you're right.
Resetting the form should set all values back to their initial value
which is set by the value attribute in the HTML. The initial value is
stored in the DOM defaultValue property, resetting the form should set
all controls back to the defaultValue.
Resetting a form should set all controls back to their defaultValue.
I don't see anywhere that programmatically changing the value
attribute should change the defaultValue property for hidden controls
only:
<URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26091157 >
Specification is not neccessarily logical and
why would you call a hidden field a "control"?''
Because that is what it is:
<URL: http://www.w3.org/TR/html4/interact/forms.html#hidden-control >
I think that if the clientside js altered a hidden field,
it is the responsability of that js [programmer] to reset it or not
after detecting the user's actions:
That is purely your opinion and seems at odds with the specification:
"Each control has both an initial value and a current value, both of
which are character strings... ... a control's "initial value" may be
specified with the control element's value attribute...
"The control's "current value" is first set to the initial value.
Thereafter, the control's current value may be modified through user
interaction and scripts.
"A control's initial value does not change. Thus, when a form is
reset, each control's current value is reset to its initial value. If
a control does not have an initial value, the effect of a form reset
on that control is undefined."
<URL: http://www.w3.org/TR/html4/interact/forms.html#h-17.2 >
I can't see how anyone can interpret that as requiring hidden controls
that have been modified by script to also be reset by script.
<input type='reset'
onclick='return manipulateHiddenFieldsAsRequired(this);'>
btw, the whole idea of using the html reset button function in a js
governed form is often not the most versatile solution,
especially in a cross browser environment.
Perhaps, depending on the situation. But that is not the issue here,
it is that some browsers do not reset controls to their initial value
when the W3C specification states that they should.
--
Rob
.
- Follow-Ups:
- Re: can't reset a hidden field in form
- From: Randy Webb
- Re: can't reset a hidden field in form
- From: Evertjan.
- Re: can't reset a hidden field in form
- References:
- can't reset a hidden field in form
- From: newbie
- Re: can't reset a hidden field in form
- From: Evertjan.
- Re: can't reset a hidden field in form
- From: newbie
- Re: can't reset a hidden field in form
- From: Evertjan.
- Re: can't reset a hidden field in form
- From: Randy Webb
- Re: can't reset a hidden field in form
- From: RobG
- Re: can't reset a hidden field in form
- From: Evertjan.
- can't reset a hidden field in form
- Prev by Date: W3c Validator usage & can't see error
- Next by Date: Re: Parallele Ajax, parameters to response handler?
- Previous by thread: Re: can't reset a hidden field in form
- Next by thread: Re: can't reset a hidden field in form
- Index(es):
Relevant Pages
|