Form Element
form is an area on a webpage that consist of plain text, html elements, and controls. Plain text and html are used to structure the form, while controls which are also known as the form fields, are used to make the form interactive by allowing user to enter information.
Attributes of form element
form is an area on a webpage that consist of plain text, html elements, and controls. Plain text and html are used to structure the form, while controls which are also known as the form fields, are used to make the form interactive by allowing user to enter information.
Attributes of form element
- action- refers to the uniform resource locator of the program in the server that processes the form.
- autocomplete- enables the autocomplete feature in the form.
- accept-character- refers to the character set in the form that can be accepted by the server.
- enctype- specifies how the information in the form should be encoded before sending it to the server.
- method- specifies how the information is sent from browser to server.
- name- refers to the name of the form.
- novalidate- specifies that the form should not validate while submitting.
- target- opens the action url in the specified target, such as in the same window, new window or new tab.
Submitting a form
After the information has been filled by the user, the user submits the form by clicking the submit button and sends the information to the server for processing. The process of transfer of the information from browser to server is performed by the enctype, action and method attributes of the form element.
The enctype attribute encodes the information from the form before transmitting it from the browser to server.
The action attribute specifies the url of the program that handles the information contained in the form.
The method attribute specifies how the information is transferred from the browser to server.
The enctype Attribute
The enctype attribute encodes the information from the form before transmitting it from the browser to server so that the information is not corrupted during the transmission. The encoding is performed by the browser. Three types of encoding process are application/x-www-form-urlencoding,
multipart/formdata and text/plain.
The application/x-www-form-urlencoding is the default encoding if no value is set for the enctype encoding.
The multipart/formdata encoding is used for those forms that contains file selection field.
The text/plain can be used along with mailto url to send information to an email address rather than a server.
The action Attribute
The action attribute specifies the url of the program that handles the information contained in the form.
<form action="http://www.webtechomaster/home/update">
the name of the program that handles the form is update and it is placed in home directory.
The method Attribute
The method attribute specifies how the information is transferred from the browser to server.
There are two methods get and post. The get method sends the information by adding it to url of the web page. This method is used when data small and there is no issue of securing it.
The post method is used when large amount of data is send to the server. It is more secure way of sending data. The data is send in two steps. In the first step, browser contacts the form processing program and in second step it sends the information to the server.
<form method="get" action="http://www.webtechomaster/home/update">
<form method="post" action="http://www.webtechomaster/home/update">
Types of Input Element
- text
- tel
- url
- password
- datetime-local
- datetime
- date
- month
- week
- time
- number
- range
- file
- hidden
- checkbox
- radio
- submit
- reset
0 comments:
Post a Comment