yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.23k stars 6.91k forks source link

MaskedInput #20211

Closed alxlnk closed 1 month ago

alxlnk commented 2 months ago

What steps will reproduce the problem?

Upgrade Yii to 2.0.50 version

What is the expected result?

Masked input with regex must work

What do you get instead?

MaskedInput initialization throws error

Additional info

jquery: 3.6.4 inputmask: 5.0.8

https://jsfiddle.net/4jx0pqgw/

Need to add the regex parameter to required list in initialization.

Q A
Yii version 2.0.50
PHP version 7.4.27
Operating system Windows
marcovtwout commented 1 month ago

@alxlnk Could you clarify: was this still working on 2.0.49 and is this a regression? Or was it already broken?

alxlnk commented 1 month ago

@marcovtwout My last update Yii is from 2.0.49.3 to 2.0.50. 2.0.49.3 version require "bower-asset/inputmask": "~3.2.2 | ~3.3.5" and regex with alias works in MaskedInput widget, but 2.0.50 require "bower-asset/inputmask": "^5.0.8 " and it broken my previous widget config.

alxlnk commented 1 month ago

PR #20212 already merged and resolve configuration issue.

alxlnk commented 1 month ago

To work correctly in version 2.0.50 you need to use the following widget configuration:

[
    'aliases' => [
        'regex' => [
            'regex' => '^.*$',
        ],
    ],
    'clientOptions' => [
        'alias' => 'regex',
    ],
]

but more simplify and valid is

[
    'clientOptions' => [
        'regex' => '^.*$',
    ],
]