how could I dynamically customize an error message (CActiveForm) ?

how could I dynamically customize an error message (CActiveForm) ?

like in this code :


$form->error($model, $attribute, $htmlOptions)

I didn’t find a solution to indicate the error message…

Maybe there is a way to override dynamically the rules of the model (CActiveRecord) ?

thanks,

Freud

The error message can be customized in the MODEL, in the function rules.

For example:


return array(


   array('field1', 'required', 'message'=>'Please fill the field')

)

thank you for you answer but I would like to modify this rule dynamically…

I’m working on something to generate forms and I would like to specify this error message at the moment of the creation of the form, independently from the creation of the model…

Is it possible ?

You may be able to achieve this by using the afterValidate event, see http://www.yiiframework.com/doc/api/1.1/CModel#afterValidate-detail