0

I try to validate my form but it doesn't work and i don't know why. Please help me to find problem. Thanks

<form action="<?php echo $this->getUrl('vendor/addproduct/new') ?>" method="post" autocomplete="off" id="form-validate" name="form-validate"
  class="scaffold-form" enctype="multipart/form-data">
    <div class="field name-name">
        <label for="<?php echo $login->getData("name"); ?>"
               class="required"><em>*</em><?php echo $this->__('Name') ?></label>
        <div class="input-box">
            <input type="text" id="<?php echo $this->getFieldId('name') ?>" 
                   name="name"
                   value="<?php echo $login->getData("name"); ?>"
                   title="<?php echo $this->__('Name') ?>" maxlength="255"
                   class="input-text required-entry"/>
       </div>
    </div>
    ...
</form>
<script type="text/javascript">
    //< ![CDATA[
    var customForm = new VarienForm('form-validate', true);
    //]]>
</script>
  • Try this way excellencemagentoblog.com/blog/2016/04/12/… it will help you. – Chirag Patel Aug 29 '18 at 4:51
  • @ChiragPatel Is there a similarity between magento 1 and magento 2? – Thanh TN Aug 29 '18 at 4:58
  • I am not sure about Magento 1 but it's working for magento 2 – Chirag Patel Aug 29 '18 at 5:03
  • 1
    please check the console log. – kunj Aug 29 '18 at 6:01
  • 1
    @kunj After check console log, i searched on google for that errors then i added jQuery.noConflict(), and it worked. Thanks. – Thanh TN Aug 29 '18 at 8:11
0

if your validate not work, try to add jQuery.noConflict()

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.