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

Use 'whenClient' on change of form fields to starred other fields #18222

Closed kambizzandi closed 4 years ago

kambizzandi commented 4 years ago

Hi

In the form with model I use one field for enabling 'required' for other fields:

    ['enable', 'boolean'],

    ['other1', 'required',
        'whenClient' => "function (attribute, value) {
            return $('#formname-enable')[0].checked;
        }"
    ],
    ['other2', 'required',
        'whenClient' => "function (attribute, value) {
            return $('#formname-enable')[0].checked;
        }"
    ],

So I expect if I check the [Enable], [other1] and [other2] starred for attention to the user. I suggest use 'whenClient' on change of form fields.

Thanks

What steps will reproduce the problem?

Check and uncheck [Enable] and look at [other1] and [other2] star indicator

What is the expected result?

I expect if I check the [Enable], [other1] and [other2] starred for attention to the user.

What do you get instead?

Other fields not starred on [Enable] checking

Additional info

Q A
Yii version 2.0.36
PHP version 7.4.7
Operating system Windows 10, Centos 7
samdark commented 4 years ago

Would you please check code from dev-master@dev? #18204 may have fixed it.

kambizzandi commented 4 years ago

Yes, i'll check it

kambizzandi commented 4 years ago

18204 fixed, but this is not act on my issue.

I'm not use inline validator in this situation. Because addRule only works on DynamicModel and my model is not.

samdark commented 4 years ago

Alright. Then I need a reduced test set to reproduce it. Ideally, starting with the https://github.com/yiisoft/yii2-app-basic and doing as little changes as possible.

yii-bot commented 4 years ago

It has been 2 or more weeks with no response on our request for more information. In order for our issue tracker to be effective, we are closing this issue.

If you want it to be reopened again, feel free to supply us with the requested information.

Thanks!

This is an automated comment, triggered by adding the label expired.