0
//creates a sfForm for the login $this->form = new sfForm(); $this->form->setWidgets(array( 'email' => new sfWidgetFormInputText(array('default' => '[email protected]')), 'password' => new sfWidgetFormInputPassword() ) ); //TODO: sfValidatorRegex on the password! $this->form->setValidators(array( 'email' => new sfValidatorEmail(), 'password' => new sfValidatorString(array( 'min_length' => 8, 'max_length' => 255), array( 'min_length' => 'Password is too short. Minimum 8 characters required.') )));
再經過我檢查了提交參數Symfony的表單驗證
if($this->form->isValid(){ loginUser(); }
要求它不事關密碼,或僞造的電子郵件,我把在多麼短,它失敗過。
感謝您的回答,我會嘗試。 – Johannes 2011-01-27 14:12:00