I added custom field in shipping method division on checkout page.
But i want to add validation on it.
So, how to add validations required and numeric to that field.
-
Could you please provide more detail. how you added input field on checkout page .Dharmendra Jadav– Dharmendra Jadav2018年07月18日 12:37:43 +00:00Commented Jul 18, 2018 at 12:37
1 Answer 1
<form class="" action="" id="" method="" data-hasrequired="* Required Fields">
<fieldset class="">
<div class="">
<label class="" for="field1"><span>Field 1 (using data-validate)</span></label>
<div class="control">
<input name="field1" id="field1" title="Field 1" value="" class="input-text" type="text" data-validate="{'validate-number':true}" />
</div>
</div>
Hope so this may help you,
there is some rule in Magento to validate input field that rules the state in "data-validate" attribute in field tag. You can validate the field for may restriction using this attribute. search for other validation rules, there are about 99 rules