0

I am trying to validate the following form in fancybox popup but it keeps on submitting the form instead of doing the validation what am I doing wrong in this? This works perfectly when Outside fancybox.

<form id="login-form-popup" method="post" action="<?php echo $this->getUrl('customer/account/loginPost') ?>">
                 <input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
                 <li>
                    <div class="input-box">
                        <label>Email ID</label>
                    <input type="text" placeholder="<?php echo $this->__('Email ID') ?>" class="input-text required-entry validate-email" name="login[username]" id="email" title="Email Address" />
                    </div>
                 </li>
                 <li>
                    <div class="input-box">
                        <label>Password</label>
                    <input type="password" placeholder="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" name="login[password]" id="pass" title="Password" />
                    </div>
                </li>
                <li>
                     <div class="input-box">
                    <input class="buttonstyle" type="submit" value="<?php echo $this->__('Login') ?>" name="subloginpop" id="subloginpop" />
                    </div>
                </li>
                <li><div class="input-box">
                     <a class="forgot-password" href="<?php echo $this->getUrl('customer/account/forgotpassword') ?>">Forgot Your Password?</a></div>
                </li>
                </form>
<script  type="text/javascript">
//<![CDATA[ 
 var theLoginFormpop = new VarienForm('login-form-popup', true);
//]]> 
</script>
0

You can checkout below link to validate any form with magento. Magento generally uses class names to validate form. All validation classes are written inside validate.js file.

Check this link to know more.

| improve this answer | |
  • It does work when I am not in fancybox so I am sure I dont have any class names incorrect – Harshada Chavan Jul 4 '16 at 9:51
  • Can you see any javascript errors in firebug. – Asheem Patro Jul 4 '16 at 9:57
  • none. just it never goes to the validation class I have written in script tag above. It is working on other phtml page just not in fancybox – Harshada Chavan Jul 4 '16 at 9:58
  • You can check this fiddle jsfiddle.net/ZMEEW, it may help you. – Asheem Patro Jul 4 '16 at 10:01
  • I want to use Varien form validation not custom I have a registration form also. – Harshada Chavan Jul 4 '16 at 10:22

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.