Capture a visitor's choices
form

A form element is a controlling wrapper for submitting user choices to the web server.
Choices are gathered from the values provided through subordinate input elements. The entire assembly of user choices are classically submitted to the server using an HTTP POST method with a payload having a content type of application/x-www-form-urlencoded
.
Properties
- action
- Use sourceref notation to specify the URI of an endpoint on the server that will process the form's submission.
- method
- The HTTP method to use when submitting the form:
POST
Form data are included in the payload. (This is the default.)GET
Form data are included as query-string variables.dialog
This is used to close a dialog box when the form is inside a dialog element.- enctype
- The content-type of the payload being submitted:
application/x-www-form-urlencoded
Values are encoded as keyword/value pairs, where the keywords come from the input elements' name attribute.multipart/form-data
A special type used when uploading files to the server.text/plain
Spaces are converted to the PLUS SIGN, but everything else remains unencoded.- autocomplete
on
The browser can assist the user by automatically providing values that were previously used on similar forms.off
The browser should not provide any automatic assistance.- novalidate
- When present, this indicates that the browser should not validate the input prior to submitting it.
- target
- The browsing context to be used when the server has finished processing the submission and returned control to the browser:
iframename
The response should be displayed in the named iframe._self
Use the same window that the form was on._blank
Use a new browser window._parent
Use the parent of the form's frameset (valid only when the form is nested within a frameset)._top
Use the topmost parent of the frameset (valid only when the form is doubly nested within a frameset).
Example
h1 Gender based studies
form `https://api.example.com/vote-for-scented-plant` *autocomplete=off {
fieldset {
legend Which is the most agreeably scented plant?
input #primrose *type=radio *name=favorite Primrose
input #plumeria *type=radio *name=favorite Plueria
input #ylang-ylang *type=radio *name=favorite Ylang-Ylang
input #lily-of-the-valley *type=radio *name=favorite Lily of the Valley
}
fieldset {
legend Gender
input #male *type=radio *name=gender Male
input #female *type=radio *name=gender Female
}
label What is your nationality
input *type=text *name=nationality
input *type=submit Submit
}