Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class accountFormSignup extends sfForm
- {
- public function configure()
- {
- $this->setWidgets(array(
- 'username' => new sfWidgetFormInput(),
- 'email' => new sfWidgetFormInput(),
- 'password' => new sfWidgetFormInput(array('type' => 'password')),
- 'password_dup' => new sfWidgetFormInput(array('type' => 'password')),
- ));
- $this->widgetSchema->setLabels(array(
- "username" => "Username :",
- "email" => "Email :",
- "password" => "Password :",
- 'password_dup' => 'Password again :',
- ));
- $this->setValidators(array(
- 'username' => new sfValidatorAnd(array(
- new sfValidatorString(array('required' => true)),
- new sfValidatorDoctrineUnique(array(
- // check that username is not present in the database
- 'model' => 'sfGuardUser',
- 'column' => 'username',
- 'required' => true
- )
- )
- )
- ),
- 'email' => new sfValidatorAnd(array(
- new sfValidatorEmail(array('required' => true)),
- // check that email is not present in the database
- new sfValidatorDoctrineUnique(array(
- 'model' => 'sfGuardUserProfile',
- 'column' => 'email',
- 'required' => true
- )
- ),
- )
- ),
- 'password' => new sfValidatorString(array('required' => true)),
- 'password_dup' => new sfValidatorString(array('required' => true)),
- ));
- $this->validatorSchema->setPostValidator(
- // to check that password and password_dup are equal
- new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_dup',
- array(),
- array('invalid' => 'Both passwords MUST be the same')
- )
- );
- $this->widgetSchema->setNameFormat('signup[%s]');
- }
- }
Add Comment
Please, Sign In to add comment