value Attributevalue Attributeparam elementOn the param element,
the value attribute is used to specify the value of the parameter
(object property) given by its name attribute. The type of value
is may be specified using the valuetype attribute (possibly
in conjunction with the type attribute).
On form controls,
the value attribute is usually used to specify
a value which will be sent in a name=value pair to the processing URI on
form submission if that control is successful (i.e. for selected options,
checked radio buttons or checkboxes and for activated submit buttons).
For certain controls, the content of the value attribute
is more accurately termed the initial value for that control.
This is because, for these controls, the value may be (and often is) subsequently
changed by the user. Such controls are text or password input boxes.
The value attribute of an
input type="text" (or
input type="password")
element specifies the initial value contained within the text (or password) box when the form is first rendered.
If this text is then changed by the user, it is this user-provided final value which
is instead sent in the name=value pair. The content of each text (or password) input field is returned to its
initial value (specified by the value attribute) if the form is reset
using, for example, a
input type="reset" button.
On buttons created using input type="submit",
input type="reset" or
input type="button", the
value attribute specifies the text to appear on the button.
In the absence of a value attribute, the submit and reset
input buttons are given default
text by the user agent (usually something like 'Submit Query' and 'Reset Form' respectively) but for
the input type="button" element
there is not usually any default text, in which case the button will be blank unless its
value attribute is specified.
For submit buttons created using
input type="submit" or
button elements,
where a name attribute is also specified,
the value attribute's contents will be sent to the processing
URI in a name=value pair if that button is the one used to submit the form.
The value attribute of an
input type="checkbox" (or
input type="radio")
element specifies the value to be sent to the processing URI in a name=value pair
if that checkbox (or radio button) is selected when the form is submitted. The name
used in the name=value pair is the contents of the element's name
attribute.
The value attribute of an
input type="hidden"
element specifies the value to be sent to the processing URI in a name=value pair
for that hidden control. The name used in the name=value pair is the contents of the element's
name attribute.
The value attribute of an
option element
specifies the value to be sent to the processing URI in a name=value pair
if that option is selected when the form is submitted. The name
used in the name=value pair is the contents of the enclosing
select element's
name attribute. If no
value attribute is specified on an
option element,
it is the contents of that element which are sent to the processing URI instead.
Note: the elements
input type="image" and
input type="file"
may both technically be given value attributes; however,
inconsistencies in user agent behaviour (which, for file upload controls,
stem from understandable security concerns) mean that the value
attribute is not documented on this site for these two elements.