I tried to validate a custom form but without success.

My form:

<div class ="shop-container">
        <div class="shop-container">
        <form data-mage-init='{"validation": {}}' action="<?php echo $this->getUrl("clubshop/index/index")?>" method="post" id="clubshop-form-custom">
            <div class="club-img">
            <div class="club-inputs">
                <div class="club-name">
                <label class="" for="email"><span>Naam</span></label><br>
                    <input name="club-name" value="" autocomplete="off" id="club-name" type="input" class="input-text" title="Naam" >
                <div class="club-email">
                    <label class="" for="email"><span>Emailadres</span></label><br>
                    <input name="club-mail" value="" id="club-email" type="input" class="input-text" title="email" ><br>
                <div class="club-button">
                    <div class="primary"><button type="submit" class="action login primary" name="send" id="send2"><span>Inloggen</span></button></div>


What I tried so far in my phtml:

<script type="text/javascript">
], function($){

   var dataForm = $('#clubshop-form-custom');
   dataForm.mage('validation', {});


and for this method i changed my button into input but still no scuccess.

], function($){
   $( "#send2" ).click(function() {        
           return false;

What i am doing wrong?

1 Answer 1


I have checked your requirement no need to add more js.

Just Add below code in input box

data-validate="{required:true, 'validate-email':true}"

Check below code

<input name="club-name"  class="input-text" data-validate="{required:true, 'validate-email':true}" >


  • Thank for your answer but still not working Sep 20, 2017 at 11:28
  • I have checked its working fine :- prnt.sc/gnfuea, Do you working on any popup design
    – shyam
    Sep 20, 2017 at 11:37
  • magneto 1 or 2? Sep 20, 2017 at 11:38
  • after i deploy my form was working. thank you very much shyam Sep 20, 2017 at 11:48
  • but this works only if a refresh the page. do you know why? Sep 20, 2017 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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