Forms & Inputs Tags with Attributes:
<form> Defines an HTML form for user input. Supports global and event attributes.
Attributes:
- accept file_type Not supported in HTML5. Defines a comma-separated list of file types that the server accepts (which can be submitted through the file upload)
- accept-charset character_set Defines the character encodings that are to be used for the form submission
- action URL Specifies where to send the form-data when a form is submitted
- autocomplete on off Specifies whether a form should have autocomplete on or off
- enctype application/x-www-form-urlencoded multipart/form-data text/plain Specifies how the form-data should be encoded when submitting it to the server (only for method="post")
- method get post Specifies the HTTP method to use when sending form-data
- name text Specifies the name of a form
- novalidate novalidate Defines the form that should not be validated when submitted
- target _blank _self _parent _top States that where to display the response which is received after submitting the form
<input> Defines an input control. Supports global and event attributes.
Attributes:
- accept file_extension audio/* video/* image/* media_type Specifies the types of files that the server accepts (only for type="file")
- align left right top middle bottom Not supported in HTML5. States the alignment of an image input (only for type="image")
- alt text Specifies an alternate text for images (only for type="image")
- autocomplete on off States whether an <input> tag should have autocomplete enabled
- autofocus autofocus Specifies that an <input> element should automatically get focus when the page loads
- checked checked States that an <input> element should be pre-selected when the page loads (only for type="checkbox" or type="radio")
- dirname inputname.dir Specifies that the text direction will be submitted
- disabled disabled Specifies that an <input> element should be disabled
- form form_id Specifies one or more forms the <input> element belongs to
- formaction URL States the URL of the file that will process the input control when the form is submitted (only for type="submit" and type="image")
- formenctype application/x-www-form-urlencoded multipart/form-data text/plain Specifies how the form-data should be encoded when submitting it to the server (for type="submit" and type="image")
- formmethod get post Defines the HTTP method for sending data to the action URL (only for type="submit" and type="image")
- formnovalidate formnovalidate Defines that form elements should not be validated when submitted
- formtarget _blank _self _parent _top framename Defines where to display the response that is received after submitting the form (only for type="submit" and type="image")
- height pixels Specifies the height of an <input> element (only for type="image")
- list datalist_id Refers to a <datalist> element that contains pre-defined options for an <input> element
- max number date Specifies the maximum value for an <input> element
- maxlength number Specifies the maximum number of characters allowed in an <input> element
- min number date States a minimum value for an <input> tag
- multiple multiple Specifies that a user can enter more than one value in an <input> element
- name text Specifies the name of an <input> element
- pattern regexp Specifies a regular expression that an <input> element's value is checked against
- placeholder text Defines a short hint that describes the expected value of an <input> tag
- readonly readonly Specifies that an input field is read-only
- required required States that an input field must be filled out before submitting the form
- size number States the width, in characters, of an <input> tag
- src URL States the URL of the image to use as a submit button (only for type="image")
- step number Specifies the legal number intervals for an input field
- type button checkbox color date datetime-local email file hidden image month number password radio range reset search submit tel text time url week States the type <input> tag to display
- value text Specifies the value of an <input> element
- width pixels Specifies the width of an <input> element (only for type="image")
<textarea> Defines a multiline input control (text area). Supports global and event attributes.
Attributes:
- autofocus autofocus Specifies that a text area should automatically get focus when the page loads
- cols number Specifies the visible width of a text area
- dirname textareaname.dir Specifies that the text direction of the textarea will be submitted
- disabled disabled Specifies that a text area should be disabled
- form form_id Specifies one or more forms the text area belongs to
- maxlength number Specifies the maximum number of characters allowed in the text area
- name text Specifies a name for a text area
- placeholder text Specifies a short hint that describes the expected value of a text area
- readonly readonly Specifies that a text area should be read-only
- required required Specifies that a text area is required/must be filled out
- rows number Specifies the visible number of lines in a text area
- wrap hard soft States how the text in a text area is to be wrapped when submitted in a form
<button> Defines a clickable button. Supports global and event attributes.
Attributes:
- autofocus autofocus States that a button should automatically get focus when the page loads
- disabled disabled Specifies that a button should be disabled
- form form_id States that one or more forms the button belongs to
- formaction URL Specifies where to send the form-data when a form is submitted. Only for type="submit"
- formenctype application/x-www-form-urlencoded multipart/form-data text/plain States how form-data should be encoded before sending it to a server. For type="submit"
- formmethod get post Specifies how to send the form-data (which HTTP method to use). Only for type="submit"
- formnovalidate formnovalidate Defines that the form-data should not be validated on submission. Only for type="submit"
- formtarget _blank _self _parent _top framename Specifies where to display the response after submitting the form. Only for type="submit"
- name name Specifies a name for the button
- type button reset submit Specifies the type of button
- value text Specifies an initial value for the button
<select> Defines a drop-down list. Supports global and event attributes.
Attributes:
- autofocus autofocus Specifies that the drop-down list should automatically get focus when the page loads
- disabled disabled States that a drop-down list should be disabled
- form form_id Defines one or more forms the select field belongs to
- multiple multiple States that multiple options can be selected at once
- name name Defines a name for the drop-down list
- required required States that the user is required to select a value before submitting the form
- size number Defines the number of visible options in a drop-down list
<optgroup> Defines a group of related options in a drop-down list. Supports global and event attributes.
Attributes:
- disabled disabled Specifies that an option-group should be disabled
- label text Defines a label for an option-group
<option> Defines an option in a drop-down list. Supports global and event attributes.
Attributes:
- disabled disabled Specifies that an option should be disabled
- label text Specifies a shorter label for an option
- selected selected Specifies that an option should be pre-selected when the page loads
- value text Specifies the value to be sent to a server
<label> Defines a label for an <input> element. Supports global and event attributes.
Attributes:
- for element_id Specifies which form element a label is bound to
- form form_id States that one or more forms the label belongs to
<fieldset> Groups related elements in a form. Supports global and event attributes.
Attributes:
- disabled disabled Defines that a group of related form elements should be disabled
- form form_id Specifies one or more forms the fieldset belongs to
- name text States a name for the fieldset
<legend> Defines a caption for a <fieldset> element. Supports global and event attributes.
Attributes:
- align top bottom left right Not supported in HTML5.Specifies the alignment of the caption
<datalist> Specifies a list of pre-defined options for input controls
<output> Defines the result of a calculation. Supports global and event attributes.
Attributes:
- for element_id States that the relationship between the result of the calculation, and the elements used in the calculation
- form form_id States one or more forms to which the output element belongs to
- name name Specifies a name for the output element
Sample Form code: (Save sample form as formcode.html)
<html>
<body>
<form style="background-color:orange">
<fieldset>
<legend>
Admission Form
</legend>
Enter your First Name:
<input name="firstname" placeholder="First Name" type="text">
<br><br>
Enter your Last Name:
<input name="firstname" placeholder="Last Name" type="text">
<br><br>
Enter your Date Of Birth:
<input name="firstname" type="date">
<br><br>
Enter your Password:
<input type="password" placeholder="password" >
<br><br>
Choose Your gender:
<input type="radio" name="sex" value="male" > Male
<input type="radio" name="sex" value="male" > Female
<br><br>
Cource<br>
<input type="checkbox" name="cource" value="html" > HTML<br>
<input type="checkbox" name="cource" value="html" > CSS<br>
<input type="checkbox" name="cource" value="html" > BOOTSTRAP<br>
<input type="checkbox" name="cource" value="html" > PHP
<p>The select element defines a drop-down list:</p>
<br><br>
Address
<br>
<textarea rows="4" cols="50">
</textarea>
<br>
Select Car
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
<br><br>
<input type="submit">
<button type="button" onclick="alert ('Your Form Sumbit ')">Save</button>
<button type="reset">Cancel</button>
</fieldset>
</form>
</body>
</html>
<!-- Form Sample. Using Form & Input tags with their attributes-->
No comments:
Post a Comment