length rule message

Hello,

I have a small bug in relation to the rules functionality. For my user change password I have three basic rules, but I’m only allowed to set the message for two of them. In the length-rule the standard error message is always shown. The two others work fine. I know the rule works because if I change the min attribute for example it gives me the error with the new length (but still the standard error message)

Here are my rules:




array('password, verifyPassword', 'required', 'message'=>Yii::t("translation", "{attribute} is required.")),

array('password', 'length', 'min' => 4, 'max'=>20, 'message'=>Yii::t("translation", "{attribute} is too short.")),

array('verifyPassword', 'compare', 'compareAttribute'=>'password', 'message'=>Yii::t("translation", "Password and Retype password do not match.")),



The message for the second one is not shown.

Regards Mads




array('password', 'length', 'min' => 4, 'max'=>20, 

    'tooShort'=>Yii::t("translation", "{attribute} is too short."),

    'tooLong'=>Yii::t("translation", "{attribute} is too long.")),



Not tested.

But according to the reference, you should define ‘tooShort’ error message and ‘tooLong’ error message for your ‘length’ rule.

CStringValidator

Thanks for your tip. It looks like its working.