문제

I have created custom module for magento review module, Now All the functionalities works fine. But default magento validation is failed for Review form. Now, How do i trigger the dafault validation to my custom module

도움이 되었습니까?

해결책

Just Add this data-hasrequired=" Required Fields" data-mage-init='{"validation":{}}' line to your form tag as show in below example and need to set validation class in input element like data-validate='{}'

<form id="test" name="test" method="post"  action="<?php echo $block->getUrl('test/index/test'); ?>" data-hasrequired="* Required Fields"  data-mage-init='{"validation":{}}'>
    <div class="input-box">
         <input name="name" id="name" title="<?php echo __('First name / last name'); ?>" value="" class="input-text required-entry" type="text" data-validate='{"required":true}'>
         </div>
    </form>

For fore info please follow this links http://inchoo.net/magento-2/validate-custom-form-in-magento-2/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top