HTML and CSS Reference
In-Depth Information Multiple buttons in a single form
You can have several buttons of the same or different types in a single
form. Even simple forms often have both reset and submit buttons, for
example. To distinguish between them, make sure each has a different
value attribute, which the browser uses for the button label. Depending
on the way you program the forms-processing application, you might
make the name of each button different, but it is usually easier to name
all similarly acting buttons the same and let the button-handling sub-
routine sort them out by value. For instance (all in HTML):
<input type=submit name=edit value="Add">
<input type=submit name=edit value="Delete">
<input type=submit name=edit value="Change">
<input type=submit name=edit value="Cancel">
When the user selects one of these example buttons, a form parameter
named edit gets sent to the server. The value of this parameter is one
of the button names. The server-side application takes the value and
behaves accordingly.
Because an image button doesn't have a value attribute, the only way to
distinguish among several image buttons on a single form is to ensure
that they all have different names.
9.5.5. Hidden Fields
The last type of form <input> control we describe in this chapter is hid-
den from view. No, we're not trying to conceal anything; it's a way to
embed information into your forms that the browser or user cannot ig-
nore or alter. The browser automatically includes the <input type=hid-
den> tag's required name and value attributes in the submitted form's
parameter list. These attributes serve to label the form and can be in-
valuable when sorting out different forms or form versions from a col-
lection of submitted and saved forms.
Search WWH ::

Custom Search