Skip to content
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

Pattern Validation via UI Component Fails to Interpret String as RegEx Pattern #9919

Closed
bap14 opened this issue Jun 12, 2017 · 11 comments
Closed
Labels
Area: Frontend bug report Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@bap14
Copy link

bap14 commented Jun 12, 2017

When using a UI Component based form and adding a custom regular expression pattern validation to an input field, the supplied pattern is not properly converted from a string to a javascript RegEx object.

Preconditions

  1. Magento EE 2.1.7, Magento CE 2.1.7
  2. PHP 7.0.17
  3. MySQL 5.7.18

Steps to reproduce

  1. Create a custom UI Component form

  2. Add a validation item to an input field

  3. Specify a pattern validation rule with a custom regular expression pattern. E.g.

     <item name="validation" xsi:type="array">
         <item name="required-entry" xsi:type="boolean">true</item>
         <item name="no-whitespace" xsi:type="boolean">true</item>
         <item name="pattern" xsi:type="string">^[a-zA-Z][a-zA-Z0-9_.-]{3,}$</item>
     </item>
    

Expected result

  1. The pattern value should be interpreted as a RegEx object OR sent through new RegEx within the javascript.

Actual result

  1. A javascript error is thrown that param.test is not a function.
    screen shot 2017-06-12 at 11 17 55 am
    screen shot 2017-06-12 at 11 16 16 am
@veloraven
Copy link
Contributor

@bap14 thank you for your report.
Given this issue is reported against Enterprise edition, please report via the Support portal of your account or Partner portal if you are a partner reporting on behalf of a merchant. Github is intended for Community edition reports given no account management for CE users. This will allow for proper tracking of issues at the account level.

@bap14
Copy link
Author

bap14 commented Jun 13, 2017

@veloraven I installed Magento CE 2.1.7 and added my custom module and confirmed this does occur in the CE release as well. I would prefer to keep this in the public domain in case there are other developers running into this same issue. I can report it in both if necessary. I'll update the initial posting to include the CE edition as well.

@bap14
Copy link
Author

bap14 commented Jun 17, 2017

I didn't specify this earlier, but I was working in the admin area, not the frontend.

@floplus
Copy link

floplus commented Jun 20, 2017

Magento CE 2.1.7, Frontend Shippment Address in Checkout, added pattern validation by LayoutProcessorPlugin:

... ['shipping-address-fieldset']['children']['street']['children'][0]['validation']['pattern'] = "/.*[0-9].*/";

Same problem: is passed as string to pattern validation in rules.js

@Stas94
Copy link

Stas94 commented Jun 29, 2017

@bap14 If this issue is actual for Enterprise Edition only, please address it to Magento Support.

@bap14
Copy link
Author

bap14 commented Jun 29, 2017

As specified a few comments back @Stas94 the issue occurs in both CE and EE.

@magento-engcom-team magento-engcom-team added 2.1.x bug report Area: Frontend Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed 2.1.x labels Oct 2, 2017
@magento-engcom-team
Copy link
Contributor

@bap14, thank you for your report.
We've created internal ticket(s) MAGETWO-80609 to track progress on the issue.

@magento-engcom-team magento-engcom-team added develop Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release labels Oct 2, 2017
@magento-engcom-team magento-engcom-team added the Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release label Oct 2, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-82426

@okorshenko
Copy link
Contributor

The issue has been fixed and delivered to 2.2-develop branch. Will be available with 2.2.2 release

@magento-team magento-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jan 26, 2018
@magento-team
Copy link
Contributor

Hi @bap14. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1284 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@sidolov sidolov added the Fixed in 2.1.x The issue has been fixed in 2.1 release line label Aug 1, 2018
@sidolov
Copy link
Contributor

sidolov commented Aug 1, 2018

Hi @bap14. Thank you for your report.
The issue has been fixed in #17213 by @mageprince in 2.1-develop branch
Related commit(s):

The fix will be available with the upcoming 2.1.15 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend bug report Fixed in 2.1.x The issue has been fixed in 2.1 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

8 participants