- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2018
10:19 AM
10-15-2018
10:19 AM
Hello every one, i need to achive that the field "phone number" only accept numbers and not alphabetical characters. all your help and references will be helpfull
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018
12:39 AM
10-16-2018
12:39 AM
You can use below shared workaround:
To validate number you can use validate-number in your module checkout_index_index.xml
<item name="telephone" xsi:type="array"> <item name="config" xsi:type="array"> <item name="tooltip" xsi:type="array"> <item name="description" xsi:type="string" translate="true">For delivery questions</item> </item> </item> <item name="validation" xsi:type="array"> <item name="min_text_length" xsi:type="number">10</item> <item name="max_text_length" xsi:type="number">10</item> <item name="validate-number" xsi:type="number">0</item> </item> </item>
OR
form should be like
<form class="form contact" action="<?php /* @escapeNotVerified */ echo $block->getFormAction(); ?>" id="contact-form" method="post" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>" data-mage-init='{"validation":{}}'>
now in input field use data-validate="{'validate-number':true}"
Your input would look like:
<input type="text" data-validate="{'validate-number':true}">
Manish Mittal
https://www.manishmittal.com/
https://www.manishmittal.com/
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018
12:39 AM
10-16-2018
12:39 AM
You can use below shared workaround:
To validate number you can use validate-number in your module checkout_index_index.xml
<item name="telephone" xsi:type="array"> <item name="config" xsi:type="array"> <item name="tooltip" xsi:type="array"> <item name="description" xsi:type="string" translate="true">For delivery questions</item> </item> </item> <item name="validation" xsi:type="array"> <item name="min_text_length" xsi:type="number">10</item> <item name="max_text_length" xsi:type="number">10</item> <item name="validate-number" xsi:type="number">0</item> </item> </item>
OR
form should be like
<form class="form contact" action="<?php /* @escapeNotVerified */ echo $block->getFormAction(); ?>" id="contact-form" method="post" data-hasrequired="<?php /* @escapeNotVerified */ echo __('* Required Fields') ?>" data-mage-init='{"validation":{}}'>
now in input field use data-validate="{'validate-number':true}"
Your input would look like:
<input type="text" data-validate="{'validate-number':true}">
Manish Mittal
https://www.manishmittal.com/
https://www.manishmittal.com/
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018
11:21 AM
10-16-2018
11:21 AM
Re: how can a make that phone number field on the delivery adress take only numbers
should I edit the file and save it, with that will work?