HTML forms are used to collect user input, which is typically sent to a server for processing. Key attributes of HTML forms include action, target, method, autocomplete, and novalidate, each serving specific functions in form submission and data handling. The document also includes tasks to explore the behavior of these attributes in practice.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
20 views15 pages
17.0 Forms
HTML forms are used to collect user input, which is typically sent to a server for processing. Key attributes of HTML forms include action, target, method, autocomplete, and novalidate, each serving specific functions in form submission and data handling. The document also includes tasks to explore the behavior of these attributes in practice.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15
HTML Forms
An HTML form is used to collect user input.
The user input is most often sent to a server for processing. TASK – The <input> Element • The HTML <input> element is the most used form element. • An <input> element can be displayed in many ways, depending on the type attribute. o Here are some examples: TASK – Format the following form using HTML tables. Show them in proper columns HTML Form Attributes The Action Attribute
• The action attribute defines the action to be
performed when the form is submitted. • Usually, the form data is sent to a file on the server when the user clicks on the submit button. The TARGET Attribute
• The target attribute specifies where to display the
response that is received after submitting the form. The METHOD Attribute
• The method attribute specifies the HTTP method
to be used when submitting the form data. • The form-data can be sent as URL variables (with method="get") or as HTTP post transaction (with method="post").
• The default HTTP method when submitting form
data is GET. TASK – Notice how form values are displayed in the address bar of the browser window after setting “method” attribute to “get” and “post” discuss The Autocomplete Attribute
The autocomplete attribute specifies
whether a form should have autocomplete on or off. When autocomplete is on, the browser automatically complete values based on values that the user has entered before. TASK – Fill in and submit the form, then reload the page, start to fill in the form again - and see how autocomplete works.
Then, try to set autocomplete to "off". (Notice how list of previously
entered values doesn’t come after autocomplete is “off” The Novalidate Attribute
The novalidate attribute is a boolean attribute.
When present, it specifies that the form-data
(input) should not be validated when submitted. TASK – Enter an email with “@” character and try submitting the following form. Then, remove the “nonvalidate” attribute and repeat the above process. Notice how tooltip error under the email box appears Discuss the result