{"id":49,"date":"2017-09-24T05:13:49","date_gmt":"2017-09-24T05:13:49","guid":{"rendered":"http:\/\/www.sureshselvam.com\/?p=49"},"modified":"2021-04-27T12:40:18","modified_gmt":"2021-04-27T12:40:18","slug":"magento-frontend-validation-classes","status":"publish","type":"post","link":"https:\/\/www.sureshselvam.com\/index.php\/2017\/09\/24\/magento-frontend-validation-classes\/","title":{"rendered":"Magento Frontend Validation Classes"},"content":{"rendered":"<p>Magento handling the validation by extenal javascript( validation.js). we need to write the form field values has been assinged.<\/p>\n<p><a href=\"https:\/\/www.sureshselvam.com\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sureshselvam.com\/wp-content\/uploads\/2017\/09\/how-to-get-magento-frontend-validation-class.jpg\" alt=\"\" width=\"625\" height=\"223\" class=\"aligncenter size-full wp-image-51\" srcset=\"https:\/\/www.sureshselvam.com\/wp-content\/uploads\/2017\/09\/how-to-get-magento-frontend-validation-class.jpg 625w, https:\/\/www.sureshselvam.com\/wp-content\/uploads\/2017\/09\/how-to-get-magento-frontend-validation-class-300x107.jpg 300w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>Below are the validation rules(class names) and their error messages.<\/p>\n<p>&#8216;validate-no-html-tags&#8217;         => &#8216;HTML tags are not allowed&#8217;<br \/>\n&#8216;validate-select&#8217;               => &#8216;Please select an option.&#8217;<br \/>\n&#8216;required-entry&#8217;                => &#8216;This is a required field.&#8217;<br \/>\n&#8216;validate-number&#8217;               => &#8216;Please enter a valid number in this field.&#8217;<br \/>\n&#8216;validate-number-range&#8217;         => &#8216;The value is not within the specified range.&#8217;<br \/>\n&#8216;validate-digits&#8217;               => &#8216;Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.&#8217;<br \/>\n&#8216;validate-digits-range&#8217;         => &#8216;The value is not within the specified range.&#8217;<br \/>\n&#8216;validate-alpha&#8217;                => &#8216;Please use letters only (a-z or A-Z) in this field.&#8217;<br \/>\n&#8216;validate-code&#8217;                 => &#8216;Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.&#8217;<br \/>\n&#8216;validate-alphanum&#8217;             => &#8216;Please use only letters (a-z or A-Z) or numbers (0-9) only in this field. No spaces or other characters are allowed.&#8217;<br \/>\n&#8216;validate-alphanum-with-spaces&#8217; => &#8216;Please use only letters (a-z or A-Z), numbers (0-9) or spaces only in this field.&#8217;<br \/>\n&#8216;validate-street&#8217;               => &#8216;Please use only letters (a-z or A-Z) or numbers (0-9) or spaces and # only in this field.&#8217;<br \/>\n&#8216;validate-phoneStrict&#8217;          => &#8216;Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.&#8217;<br \/>\n&#8216;validate-phoneLax&#8217;             => &#8216;Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.&#8217;<br \/>\n&#8216;validate-fax&#8217;                  => &#8216;Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.&#8217;<br \/>\n&#8216;validate-date&#8217;                 => &#8216;Please enter a valid date.&#8217;<br \/>\n&#8216;validate-date-range&#8217;           => &#8216;The From Date value should be less than or equal to the To Date value.&#8217;<br \/>\n&#8216;validate-email&#8217;                => &#8216;Please enter a valid email address. For example johndoe@domain.com.&#8217;<br \/>\n&#8216;validate-emailSender&#8217;          => &#8216;Please use only visible characters and spaces.&#8217;<br \/>\n&#8216;validate-password&#8217;             => &#8216;Please enter 6 or more characters. Leading or trailing spaces will be ignored.&#8217;<br \/>\n&#8216;validate-admin-password&#8217;       => &#8216;Please enter 7 or more characters. Password should contain both numeric and alphabetic characters.&#8217;<br \/>\n&#8216;validate-both-passwords&#8217;       => &#8216;Please make sure your passwords match.&#8217;<br \/>\n&#8216;validate-url&#8217;                  => &#8216;Please enter a valid URL. Protocol is required (http:\/\/, https:\/\/ or ftp:\/\/)&#8217;<br \/>\n&#8216;validate-clean-url&#8217;            => &#8216;Please enter a valid URL. For example http:\/\/www.example.com or www.example.com&#8217;<br \/>\n&#8216;validate-identifier&#8217;           => &#8216;Please enter a valid URL Key. For example &#8220;example-page&#8221;, &#8220;example-page.html&#8221; or &#8220;anotherlevel\/example-page&#8221;.&#8217;<br \/>\n&#8216;validate-xml-identifier&#8217;       => &#8216;Please enter a valid XML-identifier. For example something_5, block5, id-3.&#8217;<br \/>\n&#8216;validate-ssn&#8217;                  => &#8216;Please enter a valid social security number. For example 469-58-9875.&#8217;<br \/>\n&#8216;validate-zip&#8217;                  => &#8216;Please enter a valid zip code. For example 90605 or 90602-1234.&#8217;<br \/>\n&#8216;validate-zip-international&#8217;    => &#8216;Please enter a valid zip code.&#8217;<br \/>\n&#8216;validate-date-au&#8217;              => &#8216;Please use this date format: dd\/mm\/yyyy. For example 17\/03\/2010 for the 17th of March, 2010.&#8217;<br \/>\n&#8216;validate-currency-dollar&#8217;      => &#8216;Please enter a valid $ amount. For example $200.00.&#8217;<br \/>\n&#8216;validate-one-required&#8217;         => &#8216;Please select one of the above options.&#8217;<br \/>\n&#8216;validate-one-required-by-name&#8217; => &#8216;Please select one of the options.&#8217;<br \/>\n&#8216;validate-not-negative-number&#8217;  => &#8216;Please enter a number 0 or greater in this field.&#8217;<br \/>\n&#8216;validate-zero-or-greater&#8217;      => &#8216;Please enter a number 0 or greater in this field.&#8217;<br \/>\n&#8216;validate-greater-than-zero&#8217;    => &#8216;Please enter a number greater than 0 in this field.&#8217;<br \/>\n&#8216;validate-state&#8217;                => &#8216;Please select State\/Province.&#8217;<br \/>\n&#8216;validate-new-password&#8217;         => &#8216;Please enter 6 or more characters. Leading or trailing spaces will be ignored.&#8217;<br \/>\n&#8216;validate-cc-number&#8217;            => &#8216;Please enter a valid credit card number.&#8217;<br \/>\n&#8216;validate-cc-type&#8217;              => &#8216;Credit card number does not match credit card type.&#8217;<br \/>\n&#8216;validate-cc-type-select&#8217;       => &#8216;Card type does not match credit card number.&#8217;<br \/>\n&#8216;validate-cc-exp&#8217;               => &#8216;Incorrect credit card expiration date.&#8217;<br \/>\n&#8216;validate-cc-cvn&#8217;               => &#8216;Please enter a valid credit card verification number.&#8217;<br \/>\n&#8216;validate-ajax&#8217;                 => &#8221;<br \/>\n&#8216;validate-data&#8217;                 => &#8216;Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.&#8217;<br \/>\n&#8216;validate-css-length&#8217;           => &#8216;Please input a valid CSS-length. For example 100px or 77pt or 20em or .5ex or 50%.&#8217;<br \/>\n&#8216;validate-length&#8217;               => &#8216;Text length does not satisfy specified text range.&#8217;<br \/>\n&#8216;validate-percents&#8217;             => &#8216;Please enter a number lower than 100.&#8217;<br \/>\n&#8216;validate-cc-ukss&#8217;              => &#8216;Please enter issue number or start date for switch\/solo card type.&#8217;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Magento handling the validation by extenal javascript( validation.js). we need to write the form field values has been assinged. Below are the validation rules(class names) and their error messages. &#8216;validate-no-html-tags&#8217; => &#8216;HTML tags are not allowed&#8217; &#8216;validate-select&#8217; => &#8216;Please select an option.&#8217; &#8216;required-entry&#8217; => &#8216;This is a required field.&#8217; &#8216;validate-number&#8217; => &#8216;Please enter a valid number in this field.&#8217; &#8216;validate-number-range&#8217; => &#8216;The value is not within the specified range.&#8217; &#8216;validate-digits&#8217;&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-magento"],"_links":{"self":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/comments?post=49"}],"version-history":[{"count":2,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/posts\/49\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/categories?post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sureshselvam.com\/index.php\/wp-json\/wp\/v2\/tags?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}