I Validierungsregeln für das Modell haben alsValidierungsregeln Konflikt auf Modellszenarien yii
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
//post of step 1
if (isset($_POST['yt0']))
{
return array(
array('EmailAddress,', 'required','message' => Yii::t('message', 'USERNAME_REQUIRED')),
array('Password,', 'required','message' => Yii::t('message', 'PASSWORD_REQUIRED')),
array('confirmPassword,', 'required','message' => Yii::t('message', 'CONFIRM_PASSWORD_REQUIRED')),
array('Password','length', 'max' => 100, 'min' => 6, 'tooShort' => Yii::t('message', 'PASSWORD_LENGTH')),
array('confirmPassword', 'compare', 'compareAttribute'=>'Password','message' => Yii::t('message', 'PASSWORD_COMPARE')),
array('EmailId,', 'required','message' => Yii::t('message', 'EMAILID_REQUIRED')),
array('EmailId','email','message'=>Yii::t('message', 'EMAILID_VALID')),
array('chapterCode,', 'required','message' => Yii::t('message', 'CHAPTERCODE_REQUIRED')),
array('verifyCode,', 'required','message' =>Yii::t('message', 'VERIFYCODE_REQUIRED')),
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(),'caseSensitive'=>true,'message' =>Yii::t('message', 'VERIFYCODE_INCORRECT')),
array('EmailAddress', 'unique','className'=>'User','attributeName'=>'EmailAddress','message'=>Yii::t('message', 'EMAILID_UNIQUE')),
array('PersonId', 'unique','className'=>'User','attributeName'=>'PersonId','message'=>"Person already exists."),
array('FailedLoginCount', 'safe'),
);
} elseif (isset($_POST['yt1']))
{
return array(
array('EmailAddress,', 'required','message' => Yii::t('message', 'USERNAME_REQUIRED')),
array('Password,', 'required','message' => Yii::t('message', 'PASSWORD_REQUIRED')),
array('FailedLoginCount', 'safe'),
);
}elseif (isset($_POST['savecontact'])||$this->memBelongsto==0)
{
return array(
array('EmailAddress,', 'required','message' => Yii::t('message', 'USERNAME_REQUIRED')),
array('Password,', 'required','message' => Yii::t('message', 'PASSWORD_REQUIRED')),
array('confirmPassword', 'required','message' => Yii::t('message', 'CONFIRM_PASSWORD_REQUIRED')),
array('Password','length', 'max' => 100, 'min' => 6,'tooShort' => Yii::t('message', 'PASSWORD_LENGTH')),
array('confirmPassword', 'compare', 'compareAttribute'=>'Password','message' => Yii::t('message', 'PASSWORD_COMPARE')),
array('EmailId,', 'required','message' => Yii::t('message', 'EMAILID_REQUIRED'),'except'=>'datavalid'),
array('EmailId','email','message'=>Yii::t('message', 'EMAILID_VALID'),'except'=>'datavalid'),
array('FailedLoginCount', 'safe'),
);
}else{
return array(
array('EmailAddress,EmailId, Password', 'required'),
array('PersonId, ActiveFlag, FailedLoginCount', 'numerical', 'integerOnly'=>true),
array('EmailAddress, Password', 'length', 'max'=>100),
array('confirmPassword,', 'required','message' => Yii::t('message', 'PASSWORD_REQUIRED')),
array('Password','length', 'max' => 100, 'min' => 6, 'tooShort' => Yii::t('message', 'PASSWORD_LENGTH')),
array('confirmPassword', 'compare', 'compareAttribute'=>'Password','message' => Yii::t('message', 'PASSWORD_COMPARE')),
array('chapterCode,', 'required','message' => Yii::t('message', 'CHAPTERCODE_REQUIRED')),
array('verifyCode,', 'required','message' =>Yii::t('message', 'VERIFYCODE_REQUIRED')),
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(),'caseSensitive'=>true,'message' =>Yii::t('message', 'VERIFYCODE_INCORRECT')),
array('FailedLoginCount', 'safe'),
);
}
}
folgt und hier yt0
ist Name Taste auf Anmeldeseite äussern und so für die Registrierung der Regeln der yt0
werden angewandt, und ich habe ein anderes Formular für Passwort ändern, so auf dieser Seite Ich brauche nur drei Felder und die Schaltfläche zum Absenden für Passwort ändern ist savecontact
und aber Savecontact Regeln angewendet werden, aber die Anmelde-Schaltfläche Regeln sind widersprüchlich, so dass die Validierung bei der Anmeldung nicht funktioniert. Ist es richtig zu richtigen Regeln wie oben irgendwelche Vorschläge bitte ....
Dank Bruder für die Antwort und ich werde versuchen, diese und Ich werde fragen, ob irgendwelche Zweifel bestehen – rch