Skip to content

stripped-min-length Validation via UI Component Fails with "special" characters #9920

Closed
@bap14

Description

@bap14

When using a UI Component and adding the "stripped-min-length" validation as a rule to an input component, if the user inputs a "special" character (e.g. /, &, etc.) a javascript error is thrown.

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 UI Component based form

  2. Add the following validation to the XML form element definition

     <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="stripped-min-length" xsi:type="string">4</item>
     </item>
    
  3. Test in admin using value a/b or ab/ or a&c

Expected result

  1. Element should be invalidated due to length restriction

Actual result

  1. Javascript syntax error
    screen shot 2017-06-12 at 11 25 11 am
    screen shot 2017-06-12 at 11 25 46 am

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions