How to use HTML5 New Form Attributes

This article describe about HTML5 New Form Attributes.
  • 2313

HTML5 New Form Attributes

There are several new attribute of HTML5 for <form> and <input>

New attributes for <form>:

  • autocomplete
  • novalidate

New Attribute for <input>

  • autocomplete
  • autofocus
  • form
  • formaction
  • formenctype
  • formnovalidate
  • placeholder
  • required
  • step
  • formmethod
  • formtarget
  • height and width
  • list
  • min and max
  • multiple
  • pattern (regexp)

<form> / <input> autocomplete Attribute

This autocomplete attribute define that a form or input field should have autocomplete on or off.

When we define autocomplete is on, then browser automatically complete values the user has entered before

Note: It is also possible that autocomple attributes is "on" and "off" for specific input fields, or vice versa.

<!DOCTYPE html>
<html>
<body>
<form action="default.aspx" autocomplete="on">
Enter First name:<input type="text" name="fname" /><br />
Enter Last name: <input type="text" name="lname" /><br />
Enter Email id: <input type="email" name="email" autocomplete="off" /><br />
<input type="submit" />
</form>
<p>you fill all box and submit,then page will be reload then see how autocomplete work</p>
<p>See here that autocomplete is "on" for the form, but "off" for the e-mail field.</p>
</body>
</html>

Output of above declare code is

<form> novalidate Attribute

It is boolean attribute.

Specify that the form-data ( input) should not be validated when submitted.

 

<!DOCTYPE html>
<html>
<body>
<form action="default.axpx" novalidate="novalidate">
Enter Email: <input type="email" name="uemail" />
<input type="submit" />
</form>
</body>
</html>

Output

new1.jpg

Further Readings

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

© 2020 DotNetHeaven. All rights reserved.