4

How to validate email input field without form? I have tried with below code but not working.

<input class="input-text" 
       type="email" 
       data-validate="{required:true, 'validate-email':true}"   
       id="email" 
       type="text"
       placeholder="Enter email address" name="email"/>
  • Why would you have an input field without a form? – tecjam Apr 14 '16 at 7:57
  • Because it is form inside form. i can't placed form there because we can't nest forms within another form. – Prashant Valanda Apr 14 '16 at 8:43
  • So it is part of a form then? I don't understand. – tecjam Apr 14 '16 at 8:50
  • I have one text field on product view page i want to send it to my custom module action.Field validation is not working. – Prashant Valanda Apr 14 '16 at 8:53
1

Use the below code in js to check field validation

$("#email").valid();

It will return true if is a valid field otherwise it will return false.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.