0

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.

nikin
1,1529 silver badges19 bronze badges
asked Jul 18, 2018 at 11:41
1
  • Could you please provide more detail. how you added input field on checkout page . Commented Jul 18, 2018 at 12:37

1 Answer 1

0
<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

answered Jul 18, 2018 at 12:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.