im working quite a while now with yii but there are still things i don't get.
For example:
had a form and changed it a bit. after the change it won't work anymore.
i found out that the error depends on the validation, so i played a bit with the result that everything is fine as long as i leave the brackets empty.
$asd=new Kunden; if(isset($_POST['Kunden'])) { $asd->attributes=$_POST['Kunden']; if($asd->validate('reg')) { if($asd->save()) {
works:
if($asd->validate())
works not:
if($asd->validate('reg'))
does somebody know why?
this is the modelcode:
public function rules() { return array( // REGISTRIERUNG array('vorname, zuname, email', 'required', 'on'=>'reg'), // verifyCode needs to be entered correctly array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd'), 'on'=>'reg'), // PASSWORT VERGESSEN array('email', 'required', 'on' => 'recover'), // PROFILE array('pwd', 'compare', 'on'=>'mitpwd'), array('email', 'unique', 'on'=>'profile'), // IMMER array('user, pwd', 'length', 'max'=>35, 'min'=>3), array('email', 'email'), ); } public function safeAttributes() { return array('vorname', 'zuname', 'user', 'status', 'verifyCode', 'personalpwd', 'email', 'homepage', 'tel', 'firma', 'str', 'num', 'ort', 'plz'); return array(parent::safeAttributes(), 'reg' => 'vorname, zuname, user, pwd, pwd_repeat, ts, personalpwd, email, homepage, tel, firma, str, num, ort, plz',); return array(parent::safeAttributes(), 'mitpwd' => 'user, pwd, pwd_repeat, email, homepage, tel, firma, str, num, ort, plz',); return array(parent::safeAttributes(), 'ohnepwd' => 'user, email, homepage, tel, firma, str, num, ort, plz',); }