{"id":2634,"date":"2015-03-16T13:15:14","date_gmt":"2015-03-16T11:15:14","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=2634"},"modified":"2018-06-19T11:01:53","modified_gmt":"2018-06-19T08:01:53","slug":"html5-form-validation-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/","title":{"rendered":"HTML5 Form Validation Example"},"content":{"rendered":"<p><strong>EDITORIAL NOTE<\/strong>: In this post, we feature a comprehensive HTML5 Form Validation Example.\u00a0 Form validation is when you enter data, the web application checks it to see that the data is correct. If correct, the application allows the data to be submitted to the server and (usually) saved in a database; if not, it gives you an error message explaining what corrections need to be made.<\/p>\n<h2>Introduction<\/h2>\n<p>HTML5 has introduced a lot of changes welcomed by developers, including adding additional types of form input elements that helps in form processing activities like validation. Validating web forms has always been a painful task for many developers. Performing client side validation in a user-friendly as well as developer-friendly way is really hard. Furthermore informing users about the validation error in a pleasant way is a tedious task.<\/p>\n<p>[ulp id=&#8217;tgm4cmEWcKUikZNn&#8217;]<\/p>\n<p>Before HTML5 there was no means of implementing validation natively; therefore, developers resorted to a variety of JavaScript based solutions. Let&#8217;s get started with some coding using the new and exciting features of HTML5. Lot of these features are dependent on a specific browser versions. The version supports are getting updated every day. We have tried to present the features (that we intend to use)\u00a0versus the browser version\u00a0in the example in a table.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Comparison.jpeg\"><img decoding=\"async\" class=\"aligncenter wp-image-2714 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Comparison.jpeg\" alt=\"HTML5 Form Validation Comparison\" width=\"585\" height=\"341\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Comparison.jpeg 585w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Comparison-300x175.jpeg 300w\" sizes=\"(max-width: 585px) 100vw, 585px\" \/><\/a><\/p>\n<p>Here is a screenshot of what we we will develop today.<\/p>\n<figure id=\"attachment_2717\" aria-describedby=\"caption-attachment-2717\" style=\"width: 800px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/HTML-ValidationScreenShot.jpeg\"><img decoding=\"async\" class=\"wp-image-2717 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/HTML-ValidationScreenShot-e1425930614811.jpeg\" alt=\"HTML5 Form Validation Validation\" width=\"800\" height=\"405\" \/><\/a><figcaption id=\"caption-attachment-2717\" class=\"wp-caption-text\">HTML Validation<\/figcaption><\/figure>\n<p>Note how the elements are color coded depending on whether they are required or not. Here is how we did it. First mark the element in html as required.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;input type=&quot;email&quot; id=&quot;email&quot;\u00a0name=&quot;email&quot; value=&quot;&quot; required placeholder=&quot;arinchat@gmail.com&quot;&gt;\r\n<\/pre>\n<p>Then use a style to color code the required fields.<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\ninput:required {\r\n background: hsl(180, 50%, 90%);\r\n border: 1px solid #999;\r\n}\r\n<\/pre>\n<p>If you don&#8217;t fill out a required field and try to submit, you will get a prompt with the error as shown below.<\/p>\n<figure id=\"attachment_2729\" aria-describedby=\"caption-attachment-2729\" style=\"width: 699px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Required-e1425938679218.jpeg\"><img decoding=\"async\" class=\"wp-image-2729 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Required-e1425938679218.jpeg\" alt=\"HTML5 Form Validation Required\" width=\"699\" height=\"241\" \/><\/a><figcaption id=\"caption-attachment-2729\" class=\"wp-caption-text\">HTMLRequired<\/figcaption><\/figure>\n<h4>min and max<\/h4>\n<p>In HTML5 the min attribute together with the max attribute to create a range of legal values. The attributes works with the following input types: number, range, date, datetime, datetime-local, month, time and week. Let&#8217;s look at few interesting things before we look at the attributes.<\/p>\n<pre class=\"brush: xml; highlight: [3]; title: ; notranslate\" title=\"\">\r\n&lt;div&gt;\r\n&lt;label for=&quot;Age&quot;&gt;Age:&lt;\/label&gt;\r\n&lt;input type=&quot;number&quot; id=&quot;Age&quot;name=&quot;Age&quot; value=&quot;&quot; required min=&quot;18&quot; max=&quot;75&quot;&gt;\r\n<\/pre>\n<p>The\u00a0associated <code>label<\/code> tag has <code>for<\/code> attribute for the label tag matches up with the <code>id<\/code> attribute of the associated input tag. On top of the fact that the label is\u00a0\u00a0helping to give meaning to the input controls,\u00a0it also means that if you click the label, the associated input tag receives the focus.<\/p>\n<p>They also help with accessibility, as the text in the label will be read out to screen reader users:\u00a0This is old trick, thought that I though is wort mentioning. Another thing that we did here was to have\u00a0, providing context-sensitive help when\u00a0field it describes receives focus. Again this trick is in addition to the feature <code>placeholder<\/code> feature that we will look at a little bit later.<\/p>\n<pre class=\"brush: xml; highlight: [4]; title: ; notranslate\" title=\"\">\r\n\r\n&lt;div&gt;\r\n&lt;label for=&quot;Age&quot;&gt;Age:&lt;\/label&gt;\r\n&lt;input type=&quot;number&quot; id=&quot;Age&quot;name=&quot;Age&quot; value=&quot;&quot; required min=&quot;18&quot; max=&quot;75&quot;&gt;\r\n&lt;span id=&quot;age-format&quot; class=&quot;help&quot;&gt;Format: Number between 18 and 75&lt;\/span&gt;\r\n&lt;\/div&gt;\r\n\r\n<\/pre>\n<p>We have a little css style element that defines the way we view the span<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n\r\n.help {\r\ndisplay: none;\r\nfont-size: 90%;\r\n}\r\n\r\ninput:focus+.help {\r\ndisplay: inline-block;\r\n}\r\n\r\n<\/pre>\n<p>Here is the screenshot of validation error for min and max attributes:<\/p>\n<figure id=\"attachment_2734\" aria-describedby=\"caption-attachment-2734\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/minmax-e1425940581532.jpeg\"><img decoding=\"async\" class=\"wp-image-2734 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/minmax-e1425940581532.jpeg\" alt=\"HTML5 Form Validation min and max\" width=\"700\" height=\"510\" \/><\/a><figcaption id=\"caption-attachment-2734\" class=\"wp-caption-text\">HTML min and max<\/figcaption><\/figure>\n<h4>datalist<\/h4>\n<p>A <code>datalist\u00a0<\/code>element gets an ID attribute and contains numerous <code>OPTION <\/code>elements, just as a <code>&lt;select&gt;<\/code> element would: Once the <code>datalist<\/code>element is in place, a list attribute gets added to an <code>&lt;input&gt;<\/code> element which refers to the <code>list <\/code>id. In a nutshell, the <code>datalist <\/code>tag is used to provide an &#8220;autocomplete&#8221; feature on <code>&lt;input&gt;<\/code> element.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n\r\n&lt;input list=&quot;Countries&quot; placeholder=&quot;Country Name&quot;&gt;\r\n &lt;datalist id=&quot;Countries&quot;&gt;\r\n &lt;option value=&quot;USA&quot;&gt;\r\n &lt;option value=&quot;Greece&quot;&gt;\r\n &lt;option value=&quot;UK&quot;&gt;\r\n &lt;option value=&quot;India&quot;&gt;\r\n &lt;option value=&quot;France&quot;&gt;\r\n &lt;\/datalist&gt;\r\n\r\n<\/pre>\n<p>Please see the screenshot of <code>datalist<\/code> usage below:<\/p>\n<figure id=\"attachment_2719\" aria-describedby=\"caption-attachment-2719\" style=\"width: 765px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/DataList.jpeg\"><img decoding=\"async\" class=\"wp-image-2719 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/DataList.jpeg\" alt=\"HTML5 Form Validation DataList\" width=\"765\" height=\"358\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/DataList.jpeg 765w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/DataList-300x140.jpeg 300w\" sizes=\"(max-width: 765px) 100vw, 765px\" \/><\/a><figcaption id=\"caption-attachment-2719\" class=\"wp-caption-text\">DataList<\/figcaption><\/figure>\n<h4>placeholder<\/h4>\n<p>The ability to set placeholder text in an input field is new and welcome addition to Html5 webforms. The placeholder attribute can only contain text, not HTML markup. Placeholder text is displayed inside the input field as long as the field is empty. When you click on (or tab to) the input field and start typing, the placeholder text disappears.<\/p>\n<pre class=\"brush: xml; highlight: [2]; title: ; notranslate\" title=\"\">\r\n\r\n&lt;input type=text autofocus id=&quot;name&quot; name=&quot;name&quot; value=&quot;&quot; placeholder=&quot;firstname lastname&quot; required&gt;\r\n\r\n<\/pre>\n<h4>autofocus<\/h4>\n<p>HTML 5 has introduced a new Boolean attribute called <code>autofocus<\/code> attribute on all webform controls.\u00a0 As soon as the page loads, it moves the input focus to a particular input field. See the example below:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;input type=text autofocus&gt;\r\n<\/pre>\n<h4>pattern<\/h4>\n<p>This attributes helps the developer to specify\u00a0 a JavaScript regular expression for the field\u2019s value to be checked against.\u00a0 Hence we can use pattern to implement specific validation\u00a0 like phone number, product code, zip code etc. The pattern attribute works with the following input types: text, search, url, tel, email, and password. See the example code below.<\/p>\n<pre class=\"brush: xml; highlight: [1]; title: ; notranslate\" title=\"\">\r\n\r\n&lt;input type=&quot;text&quot; id=&quot;ID&quot;required name=&quot;ID&quot; pattern=&quot;&#x5B;0-9]&#x5B;A-Z]{3}&quot;\r\n placeholder=&quot;&#x5B;0-9]&#x5B;A-Z]-Single digit &amp; 3 letters&quot;\r\n title=&quot;Single digit followed by three uppercase letters&quot;&gt;\r\n\r\n<\/pre>\n<p>Here is screenshot of validation error if you don&#8217;t enter the field in the expected pattern:<\/p>\n<figure id=\"attachment_2733\" aria-describedby=\"caption-attachment-2733\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Pattern-e1425940335606.jpeg\"><img decoding=\"async\" class=\"wp-image-2733 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Pattern-e1425940335606.jpeg\" alt=\"HTML5 Form Validation Pattern\" width=\"700\" height=\"498\" \/><\/a><figcaption id=\"caption-attachment-2733\" class=\"wp-caption-text\">HTML Pattern<\/figcaption><\/figure>\n<h4>date, datetime-local,month,time,week<\/h4>\n<p>HTML5 finally defines a way to include a native date picker control without having to script it yourself. In fact, it defines 5 kinds of them: date, month, week, time, datetime-local.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n\r\n&lt;input\u00a0type=&quot;date&quot; id=&quot;Date&quot; name=&quot;Date&quot;&gt;\r\n\r\n&lt;input type=&quot;week&quot; id=&quot;Week&quot;\u00a0name=&quot;Week&quot;&gt;\r\n\r\n&lt;input type=&quot;month&quot; id=&quot;Month&quot;\u00a0name=&quot;Month&quot;&gt;\r\n\r\n&lt;input type=&quot;time&quot; id=&quot;Time&quot;\u00a0name=&quot;Time&quot;&gt;\r\n\r\n&lt;input type=&quot;datetime-local&quot;\u00a0id=&quot;DateTime&quot; name=&quot;DateTime&quot;&gt;\r\n\r\n<\/pre>\n<p>Below is screenshot of datepicker included in HTML5:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Week.jpeg\"><img decoding=\"async\" class=\"alignnone wp-image-2727\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Week-e1425938089335.jpeg\" alt=\"HTML5 Form Validation Date Picker\" width=\"739\" height=\"425\" \/><\/a><\/p>\n<h4>email<\/h4>\n<p>The input type as <code>email<\/code> is used for input fields that should contain an e-mail address. Depending on browser support, the e-mail address can be automatically validated when submitted. Here is a screenshot of an error shown if you do not fill the email in the correct way. Some smartphones\u00a0recognize the email\u00a0type, altering their virtual keyboard to the keyboard to match email\u00a0input.<\/p>\n<figure id=\"attachment_2730\" aria-describedby=\"caption-attachment-2730\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Email-e1425938939721.jpeg\"><img decoding=\"async\" class=\"wp-image-2730 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Email-e1425938939721.jpeg\" alt=\"HTML5 Form Validation Email Validation\" width=\"700\" height=\"296\" \/><\/a><figcaption id=\"caption-attachment-2730\" class=\"wp-caption-text\">HTML Email Validation<\/figcaption><\/figure>\n<h4>url<\/h4>\n<p>The <code>&lt;input type=\"url\"&gt;<\/code> is used for input fields that should contain a URL address. Most modern desktop browsers simply render <code>type=\"url\"<\/code> like a regular text box, so users won\u2019t even notice until they submit the form. Depending on browser support, the url field can be automatically validated when submitted. Some smartphones like iPhone recognize the url type, alters its virtual keyboard and adds &#8220;.com&#8221; a period, a forward slash, to the keyboard to match url input. Here is a screenshot of validation error for url.<\/p>\n<figure id=\"attachment_2731\" aria-describedby=\"caption-attachment-2731\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/URL-e1425939704571.jpeg\"><img decoding=\"async\" class=\"wp-image-2731 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/URL-e1425939704571.jpeg\" alt=\"HTML5 Form Validation URL Validation\" width=\"700\" height=\"383\" \/><\/a><figcaption id=\"caption-attachment-2731\" class=\"wp-caption-text\">HTML URL Validation<\/figcaption><\/figure>\n<h4>color<\/h4>\n<p>The <code>&lt;input type=\"color\"&gt;<\/code> is used for input fields that should contain a color. You will get a color picker if your browser supports. This has not much of a usage for validation.I thought of mentioning it as the feature is pretty cool .<\/p>\n<figure id=\"attachment_2732\" aria-describedby=\"caption-attachment-2732\" style=\"width: 700px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Color-e1425940037530.jpeg\"><img decoding=\"async\" class=\"wp-image-2732 size-full\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/Color-e1425940037530.jpeg\" alt=\"HTML5 Form Validation Color Picker \" width=\"700\" height=\"409\" \/><\/a><figcaption id=\"caption-attachment-2732\" class=\"wp-caption-text\">HTML Color Picker<\/figcaption><\/figure>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/03\/HTML5Validation.zip\"><strong>HTML5Validation<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>EDITORIAL NOTE: In this post, we feature a comprehensive HTML5 Form Validation Example.\u00a0 Form validation is when you enter data, the web application checks it to see that the data is correct. If correct, the application allows the data to be submitted to the server and (usually) saved in a database; if not, it gives &hellip;<\/p>\n","protected":false},"author":47,"featured_media":914,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-2634","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html5"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>HTML5 Form Validation Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Interested to learn about HTML5 Form Validation? Check out our Example on all the different attributes we encounter on a Form Validation like email, dates..\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML5 Form Validation Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about HTML5 Form Validation? Check out our Example on all the different attributes we encounter on a Form Validation like email, dates..\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-16T11:15:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-06-19T08:01:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Arindam Chattopadhya\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Arindam Chattopadhya\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/\"},\"author\":{\"name\":\"Arindam Chattopadhya\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/78b9675665f8627e97ed2dd1fd8cdf00\"},\"headline\":\"HTML5 Form Validation Example\",\"datePublished\":\"2015-03-16T11:15:14+00:00\",\"dateModified\":\"2018-06-19T08:01:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/\"},\"wordCount\":1404,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"articleSection\":[\"HTML5\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/\",\"name\":\"HTML5 Form Validation Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"datePublished\":\"2015-03-16T11:15:14+00:00\",\"dateModified\":\"2018-06-19T08:01:53+00:00\",\"description\":\"Interested to learn about HTML5 Form Validation? Check out our Example on all the different attributes we encounter on a Form Validation like email, dates..\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML5\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/html5\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"HTML5 Form Validation Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/78b9675665f8627e97ed2dd1fd8cdf00\",\"name\":\"Arindam Chattopadhya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4c54fbd5748a5a51f90f73ca68fe86ae6bf8e416966a283b2c05bf15c86c4dd3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4c54fbd5748a5a51f90f73ca68fe86ae6bf8e416966a283b2c05bf15c86c4dd3?s=96&d=mm&r=g\",\"caption\":\"Arindam Chattopadhya\"},\"description\":\"Arindam has completed Masters in Information Technology. His expertise includes enterprise applications architecture, application integration, legacy connectivity, user interface engineering, systems analysis and distributed systems architecture and design. He has hand-on expertise on Java EE , web technology and mobile application development.\",\"sameAs\":[\"http:\/\/www.webcodegeeks.com\/\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/arindam-chattopadhya\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML5 Form Validation Example - Web Code Geeks - 2026","description":"Interested to learn about HTML5 Form Validation? Check out our Example on all the different attributes we encounter on a Form Validation like email, dates..","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/","og_locale":"en_US","og_type":"article","og_title":"HTML5 Form Validation Example - Web Code Geeks - 2026","og_description":"Interested to learn about HTML5 Form Validation? Check out our Example on all the different attributes we encounter on a Form Validation like email, dates..","og_url":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2015-03-16T11:15:14+00:00","article_modified_time":"2018-06-19T08:01:53+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","type":"image\/jpeg"}],"author":"Arindam Chattopadhya","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Arindam Chattopadhya","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/"},"author":{"name":"Arindam Chattopadhya","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/78b9675665f8627e97ed2dd1fd8cdf00"},"headline":"HTML5 Form Validation Example","datePublished":"2015-03-16T11:15:14+00:00","dateModified":"2018-06-19T08:01:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/"},"wordCount":1404,"commentCount":1,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","articleSection":["HTML5"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/","url":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/","name":"HTML5 Form Validation Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","datePublished":"2015-03-16T11:15:14+00:00","dateModified":"2018-06-19T08:01:53+00:00","description":"Interested to learn about HTML5 Form Validation? Check out our Example on all the different attributes we encounter on a Form Validation like email, dates..","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/html5-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/html5\/html5-form-validation-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"HTML5","item":"https:\/\/www.webcodegeeks.com\/category\/html5\/"},{"@type":"ListItem","position":3,"name":"HTML5 Form Validation Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/78b9675665f8627e97ed2dd1fd8cdf00","name":"Arindam Chattopadhya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4c54fbd5748a5a51f90f73ca68fe86ae6bf8e416966a283b2c05bf15c86c4dd3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4c54fbd5748a5a51f90f73ca68fe86ae6bf8e416966a283b2c05bf15c86c4dd3?s=96&d=mm&r=g","caption":"Arindam Chattopadhya"},"description":"Arindam has completed Masters in Information Technology. His expertise includes enterprise applications architecture, application integration, legacy connectivity, user interface engineering, systems analysis and distributed systems architecture and design. He has hand-on expertise on Java EE , web technology and mobile application development.","sameAs":["http:\/\/www.webcodegeeks.com\/"],"url":"https:\/\/www.webcodegeeks.com\/author\/arindam-chattopadhya\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/2634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/47"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=2634"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/2634\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/914"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=2634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=2634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=2634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}