More about WEB PAGE
Anatomy of the <head>
Grouping content
- Understanding the need to group content
- Using the div Element
- Grouping content into lists
- Dealing with figures
Creating advanced tables
- Adding table headers cells
- Denoting the headings and the table body
- Creating irregular tables
- Applying borders to the table element
Form Handling
- The action attribute
- The method attribute
- Configuring the Data Encoding
- Controlling form completion
- Setting the name of the form
- Adding labels to a form
- Automatically focusing on an input element
- Disabling individual input elements
- Grouping form elements together
- Using the button element
Customizing the input element
- Using the input element for text input
- Setting values and using placeholders
- Using a data list
- Creating read-only and disabled text boxes
- Restrict data entry
Using input validation
The name attribute lets you set a unique identifier for a form so that you can distinguish between forms when working with the Document Object Model (DOM). The name attribute is distinct from the id global attribute, and in most cases, HTML documents use the id attribute for CSS selectors. Below we can see a form element to which the name and id attributes have been applied. We have used the same value for both attributes for the sake of simplicity.
<html>
<head>
<title>Example</title>
<meta name="author" content="Adam Freeman"/>
<meta name="description" content="A simple example"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
</head>
<body>
<form name="fruitvote" id="fruitvote" method="post" action="http://titan:8080/form">
<input name="fave"/>
<input name="name"/>
<button>Submit Vote</button>
</form>
</body>
</html>
The value of the name attribute is not sent to the server when the form is posted, which is why this attribute has value only in the DOM and is not as important as the name attribute on the input element. If an input element doesn’t have a name attribute, the data that the user has entered will not be sent to the server when the form is submitted.