I have one form in hader.phtml of magento.I have added the following line after form and used class="required-entry" for applying validation. In all other pages validtaion is working.But in homepage its not working.can anyone help me.

<script type="text/javascript"> //< ![CDATA[ var myForm= new VarienForm('new_login', true); //]]> </script>

1 Answer 1


Follow the Below Steps.

First create the form.

<form id="form-id" action="" method="post">
  <label for="name" class="required"><?php echo $this->__('Name'); ?></label>
      <div class="input-box">
          <input id="name" type="text" name="name" value="" class="input-text required-entry">

Then add the Below Code.

<script type="text/javascript">
     var dataForm = new VarienForm('form-id', true);

Check and Enjoy the validation Make sure Form Id and VarienForm name will be same.

  • Its is working fine in all other pages.Only in my homepage its not working.
    – Anu
    May 14, 2014 at 4:24
  • strange.............
    – Keyul Shah
    May 14, 2014 at 4:26
  • I have used Responsivebanner slider for homepage slider.Its because of that.Is it possible to resolve it?
    – Anu
    May 14, 2014 at 4:28
  • try to solve the jQuery conflict.
    – Keyul Shah
    May 14, 2014 at 5:08

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.