Skip to content

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

Conversation

Usik2203
Copy link
Contributor

@Usik2203 Usik2203 commented Apr 1, 2020

Description (*)

This PR adds validation for phone field on checkout page

Before

2020-04-01 18 20 28

After

2020-04-01 19 45 02

Resolved issues:

  1. resolves [Issue] Add validation phone field on checkout page #28800: Add validation phone field on checkout page

@m2-assistant
Copy link

m2-assistant bot commented Apr 1, 2020

Hi @Usik2203. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@Usik2203
Copy link
Contributor Author

Usik2203 commented Apr 1, 2020

@magento give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @Usik2203. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @Usik2203, here is your new Magento instance.
Admin access: https://pr-27537.instances.magento-community.engineering/admin_98d6
Login: 97f5d420 Password: 30b32e51d22f
Instance will be terminated in up to 3 hours.

Copy link
Contributor

@krzksz krzksz left a 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);
Copy link
Contributor

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:

Suggested change
/^[+]*[(]{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);

Copy link
Contributor Author

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')
Copy link
Contributor

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?

Copy link
Contributor Author

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

@Usik2203
Copy link
Contributor Author

Usik2203 commented Apr 17, 2020

Hi @krzksz
Any news about this PR ?
Could I kindly ask you to check it If you will have free slot of time
Thank you a lot !

@krzksz krzksz added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Progress: needs update and removed Progress: ready for testing labels Apr 18, 2020
@magento-engcom-team
Copy link
Contributor

Hi @krzksz, thank you for the review.
ENGCOM-7457 has been created to process this Pull Request
✳️ @krzksz, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Delta engcom-Delta self-assigned this Apr 22, 2020
@engcom-Delta
Copy link
Contributor

Hi @krzksz . You add label "Needs update". Is there any changes need to be done ?

@krzksz
Copy link
Contributor

krzksz commented Apr 22, 2020

@engcom-Delta Missclick, my bad.

@Usik2203
Copy link
Contributor Author

@magento run all tests

@Usik2203
Copy link
Contributor Author

@magento run all tests

@engcom-Echo engcom-Echo requested a review from krzksz July 6, 2020 07:17
@magento-engcom-team
Copy link
Contributor

Hi @krzksz, thank you for the review.
ENGCOM-7457 has been created to process this Pull Request

@engcom-Delta
Copy link
Contributor

✔️ QA passed
Result with fix:
#27537PR1
#27537PR2

@engcom-Delta engcom-Delta added QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Jul 13, 2020
@engcom-Alfa engcom-Alfa added QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Jul 22, 2020
@engcom-Echo
Copy link
Contributor

@magento run all tests

@m2-assistant
Copy link

m2-assistant bot commented Aug 1, 2020

Hi @Usik2203, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@sdzhepa
Copy link
Contributor

sdzhepa commented Aug 19, 2020

This PR will be reverted due to issue found during regression testing

More details in the description: #29682
and qa comment: #29682 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Checkout Component: Customer Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Priority: P3 May be fixed according to the position in the backlog. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Issue] Add validation phone field on checkout page