IT. Expert System.

HTML

Overview


Overview

HTML forms are used to select different kinds of user input and pass this information to a server.

A form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements.

The <form> tag is used to create an HTML form:

<form>
  input elements
</form>

The Input Element

An input element is used to select user information and can vary in many ways, depending on the type attribute. An input element can be of type text field, checkbox, password, radio button, submit button, and more.

Text Field

A text field is a one-line input field that a user can enter text into. It is defined by <input type="text" />.

Password Field

A password field is a the same as a text field except the entered characters are masked (shown as asterisks or circles). It is defined by <input type="password" />.

Radio Buttons

Radio buttons are used to allow a user to select only one of a number of choices. It is defined by <input type="radio" />:

<form>
  <input type="radio" name="color" value="red" />Red
  <br />
  <input type="radio" name="color" value="green" />Green
  <br />
  <input type="radio" name="color" value="blue" />Blue
</form>

This produces the following result:

Red
Green
Blue

Checkboxes

Checkboxes are used to allow a user to select zero or more options from a number of choices. It is defined by <input type="checkbox" />.

<form>
  <input type="checkbox" name="color" value="red" />Red
  <br />
  <input type="checkbox" name="color" value="green" />Green
  <br />
  <input type="checkbox" name="color" value="blue" />Blue
</form>

This produces the following result:

Red
Green
Blue

Submit Button

A submit button is used to send form data to a server. The submit button causes the page specified by the action attribute of the <form> element to be executed. It is defined by <input type="submit" />.

<form action="form_action.asp" method="get">
  Username: 
  <input type="text" name="username" />
  <br />
  Password: 
  <input type="password" name="password" />
<br />
  <input type="submit" value="Submit" />
</form>

This produces the following result:

Username:
Password:

HTML5 New Form Elements

HTML5 has added several new form elements. The new form elements are:

  • datalist - used to specify a list of options for an input field
  • keygen - used to provide a secure way to authenticate users
  • output - used for different types of output, like calculations or script output

HTML5 New Form Attributes

HTML5 added new attributes for the <form> and <input> elements.

The new attributes for <form> are:

  • autocomplete - specifies that the form should have an autocomplete function
  • novalidate - specifies that the form should not be validated when submitted

The new attributes for <input> are:

  • autocomplete - specifies that the input field should have an autocomplete function
  • autofocus - specifies that a field should automatically get focus when a page is loaded
  • form - specifies one or more forms the input field belongs to
  • formaction - overrides the form action attribute
  • formenctype - overrides the form enctype attribute
  • formmethod - overrides the form method attribute
  • formnovalidate - overrides the form novalidate attribute
  • formtarget - overrides the form target attribute
  • height - specifies the height of the image used for the input type image
  • list - specifies a datalist for an input field
  • min, max, step - specifies restrictions for input types containing numbers or dates
  • multiple - specifies that multiple values can be selected for an input field
  • pattern - specifies a pattern used to validate an input field
  • placeholder - specifies a hint that describes the expected value of an input field
  • required - specifies that an input field must be filled out before submitting
  • width - specifies the width of the image used for the input type image

HTML5 New Input Types

HTML5 added several new input types for forms to provide better input control and validation.

The new input types are:

  • color - specifies the input field should contain a color
    <input type="color" placeholder="e.g. #c0c0c0" />
  • date - specifies the input field should contain a date (date, month, year)
    <input type="date" min="2010-11-01" max="2011-11-01" value="2010-11-01"/>
  • datetime - specifies the input field should contain time and date (time, date, month, year in UTC time)
  • datetime-local - specifies the input field should contain time and date (time, date, month, year in local time)
  • email - specifies the input field should contain an e-mail address
    <input type="email" value="name@email.com" />
  • month - specifies the input field should contain a month and year
  • week - specifies the input field should contain a week and year
  • time - specifies the input field should contain a time (hour and minute)
  • search - specifies the input field should appear as a search field
    <input type="search" results="10" placeholder="Search..." />
  • url - specifies the input field should contain a URL
  • number - specifies the input field should contain a numeric value
    <input type="number" step="1" min="-5" max="10" value="0" />
  • range - specifies the input field should contain a value from a range of numbers (slider bar)
    <input type="range" min="0" max="50" value="10" />
  • tel - specifies the input field should contain a telephone number
    <input type="tel" placeholder="(101) 555-1212" pattern="^\(?\d{3}\)?[-\s]\d{3} [-\s]\d{4}.*?$" />


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 27 / 158692742. Delta: 0.03033 с