The intent is for the priorRate attribute to only be required if the priorMil attribute’s radio button is set to Yes. The problem is that whether the priorMil attribute’s radio button is set to No (value = “0”) or Yes (value = “1”), the priorRate remains required.
I have the same issue and cant seem to get when and whenClient to work.
If the when is set and not the when client It always validates the attribute regardless of what the rule is. If the whenclent is set with when it will never validate.
I copied and pasted the docs / guide and still couldn’t to get it to work. I’ve checked the scenario and it’s correct and all the other rules for the same attribute work correctly just not the when or the whenclient
Does work, no change in the model between activefields, the only difference is radioList vs. dropDownList… Could this be a bug or is there something in the logic behind a radioList that I am not considering.
We got it to work…Kind of… A couple things to note with this.
Does not work with radio list and possibly others (i would assume check box, checkboxlist and radio because they are all rendered the same).
You can manually set the ID on the fields. You must use the default Yii generated ID or the client validation will not work on the field.
ie id="priorMil". I had to remove ID from the form field and in the whenClient use the ID Yii made. In this case it ended up being modelname-fieldname (all lowercase).
When the conditional value validates it will not re-validate if the value changes. i.e. if the dropdown was == 1 and was valid if the dropdown ==0 it will not re validate the conditional field until submit. Still trying to figure that one out.