-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Forced validation in yiiActiveForm do not trigger afterValidate event #14186
Comments
I can confirm that lenyy 's fix works. Thank you! I've been wrestling with this problem for too long. I'll post back if I encounter any problems. |
@jesseteal np but be careful if you change the updateInputs function from yii because once you composer update and composer finds a new yii version that file probably will be overwritten by it. |
Now to validation form by manually: If If If If |
@jesseteal, @lenyy I've re-checked it with a fix and it seems it doesn't work well. It validates field that triggered validation but marks the rest of the fields as valid while they either aren't yet validated or aren't valid. |
sorry i forgot to post my form settings. Currently i have
for my workaround to work,. @samdark did you check with the workaround i posted? When i tried i got the desired results, i did not change because when you realeased a new version mine would get overwriten by new version so i opted to stay with bug version and control the events my self |
I did. My comment is about it. |
Oh ok sorry, if you need any help just say i can try and test it |
Thanks @samdark and @arogachev for the fix. |
Hi there, so for me YiiActiveForm is not performing validation on field when is set manually so i need your help to check if its my problem or Yii.
From the Yii cookbook if we want to perform validation on form we just need to call
we assume that it should validate the whole form and send the event afterValidate because the form was validated. But that doesn't happen and its because of this lines in yii.activeForm.js
that clearly say that the event afterValidate can only be launched if we are trying to submit the form which we don't because we only want the validation itself.
Currently i have a workaround by playing with the events that looks like this
but its dirty and unnecessary if the event could be fired after the validation ends.
To solve that problem it could be as simple as
we just pass the errorAttributes setting and the form event before checking if we are submitting. because we want validation only.´
Yii Version 2.0.11.2
Thanks in advance
The text was updated successfully, but these errors were encountered: