最小长度规则不适用于';我不接受Yii格式的邮件
我的模型规则中的以下代码在Yii中起作用最小长度规则不适用于';我不接受Yii格式的邮件,yii,rule,Yii,Rule,我的模型规则中的以下代码在Yii中起作用 public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('mail, firstname, lastname, number, question, time', 'required','messa
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('mail, firstname, lastname, number, question, time', 'required','message'=>'{attribute} نمی تواند خالی باشد'),
array('status', 'numerical', 'integerOnly'=>true,'message'=>'{attribute} فقط مقادیر عددی مجاز است'),
array('mail, firstname, lastname, number', 'length', 'max'=>45,'message'=>'حداکثر طول {attribute} ۴۵ کارکتر می باشد'),
array('question','length','min'=>10,'message'=>'حداقل طول سوال ۱۰ کارکتر می باشد'),
array('mail','email','message'=>'ایمیل وارد شده حقیقی نمی باشد'),
array('time','unsafe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, mail, firstname, lastname, number, question, time, status', 'safe', 'on'=>'search'),
);
}
除了我定义的最小长度外,所有消息都正常工作
array('question','length','min'=>10,'message'=>'حداقل طول سوال ۱۰ کارکتر می باشد'),
它总是返回Yii的默认值,这意味着پسش太短(最少10个字符)。当字段的长度不是由指定的某个精确长度时,将使用
消息
属性。对于自定义最小长度消息,请使用:
array('question','length','min'=>10,'tooShort'=>'حداقل طول سوال ۱۰ کارکتر می باشد'),