option to only validate visible fields with clientvalidation

I have some fields which should only be validated if they are visible (password change fields).

Would be good to specify they should only run client validation if they are currently visible.

Something like,

public function clientValidateAttribute($object,$attribute) {


    if($('#' + this.id).is(':visible') && $.trim(value)=='') {



Google "jonahs yii validation scenarios" that should point you in the right direction.

I tried adding a link but because I’m new on here it wouldn’t let me.

I guess model scenarios are covering this very well.