0

I have to create a validation for the telephone inputs in Magento Admin. I need to set a min of characters like 8 and a max of 15. I'm currently using 2.2.8 version.

I tried to set the validation by admin using telephone attribute, but it didn't work. It inserts a class for validation but doesn't validate at all.

Thanks!

Mohit Rane
2,0001 gold badge18 silver badges52 bronze badges
asked Aug 2, 2019 at 3:47
5
  • do you want this validation in system.xml file or in custom form? Commented Aug 2, 2019 at 4:46
  • Hi @MohitRane, I want it for the new customer form and billing and shipping form inside the admin, but I don't even know where to look. =( Commented Aug 12, 2019 at 3:24
  • do you want this change in custom module functionality or you to want to change in Magento's default functionality? Commented Aug 12, 2019 at 4:30
  • Hey @MohitRane, I want to change in Magento's default functionality. Commented Aug 12, 2019 at 22:29
  • can you share the screenshot of where you want this validation to make sure we're talking about the same thing? Commented Aug 13, 2019 at 5:02

1 Answer 1

1

Put the following code inside the telephone number block in your layout file

 <item name="validation" xsi:type="array">
 <item name="min_text_length" xsi:type="number">8</item>
 <item name="max_text_length" xsi:type="number">15</item>
 <item name="validate-number" xsi:type="number">0</item>
 </item>
answered Aug 2, 2019 at 7:55

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.