-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add validation phone field on checkout page #27537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add validation phone field on checkout page #27537
Conversation
Hi @Usik2203. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
@magento give me test instance |
Hi @Usik2203. Thank you for your request. I'm working on Magento instance for you |
Hi @Usik2203, here is your new Magento instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thank you for your contribution! Can you please address my comments to the code?
'validate-phone': [ | ||
function (value) { | ||
return utils.isEmptyNoTrim(value) || | ||
/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$/.test(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to my tests, the slash has to be escaped:
/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$/.test(value); | |
/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\.\/0-9]*$/.test(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed it.
Thank You for advice
return utils.isEmptyNoTrim(value) || | ||
/^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$/.test(value); | ||
}, | ||
$.mage.__('Please enter a valid phone number. For example (123) 456-7890, 123-456-7890, +(123)4567890, +1234567890') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static tests are failing because of this line length, can you please break it into multiple lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed by add //eslint-disable-line max-len
on the end string
like on the others cases in this file
Thanks for advice
Hi @krzksz |
Hi @krzksz, thank you for the review.
|
Hi @krzksz . You add label "Needs update". Is there any changes need to be done ? |
@engcom-Delta Missclick, my bad. |
@magento run all tests |
@magento run all tests |
Hi @krzksz, thank you for the review. |
@magento run all tests |
Hi @Usik2203, thank you for your contribution! |
This PR will be reverted due to issue found during regression testing More details in the description: #29682 |
Description (*)
This PR adds validation for phone field on checkout page
Before
After
Resolved issues: