Example #1
0
 public function initialize($entity = null, $options = null)
 {
     parent::initialize();
     // In edition the id is hidden
     if (isset($options['edit']) && $options['edit']) {
         $id = new Hidden('id');
         $id->addValidators(array(new PresenceOf(array('message' => 'ID missing'))));
         $this->add($id);
     } else {
         // Password
         $password = new Password('password', array('placeholder' => 'Password'));
         $password->setLabel('Password');
         $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters'))));
         $this->add($password);
     }
     $name = new Text('name', array('placeholder' => 'Name'));
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($name);
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->setLabel('Email');
     $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid'))));
     $this->add($email);
     $this->add(new Select('validated', array('1' => 'Yes', '0' => 'No')));
     $this->add(new Select('active', array('1' => 'Yes', '0' => 'No')));
     $this->add(new Submit('Save'));
 }
Example #2
0
 public function initialize()
 {
     parent::initialize();
     // Email
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->setLabel('Email');
     $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid'))));
     $this->add($email);
     // Sign Up
     $this->add(new Submit('Send', array('class' => 'btn btn-success')));
 }
Example #3
0
 public function initialize()
 {
     parent::initialize();
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->setLabel('New Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Confirmation(array('message' => 'Password doesn\'t match confirmation', 'with' => 'confirmPassword'))));
     $this->add($password);
     // Confirm Password
     $confirmPassword = new Password('confirmPassword', array('placeholder' => 'Confirm Password'));
     $confirmPassword->setLabel('Confirm New Password');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
     // Sign Up
     $this->add(new Submit('Change Password', array('class' => 'btn btn-success')));
 }
Example #4
0
 public function initialize()
 {
     parent::initialize();
     $name = new Text('name', array('placeholder' => 'Name'));
     $name->setLabel('Name');
     $name->addValidators(array(new PresenceOf(array('message' => 'The name is required'))));
     $this->add($name);
     // Email
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->setLabel('Email');
     $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid')), new Confirmation(array('message' => 'Email doesn\'t match confirmation', 'with' => 'confirmEmail'))));
     $this->add($email);
     // Confirm Email
     $confirmEmail = new Text('confirmEmail', array('placeholder' => 'Confirm Email'));
     $confirmEmail->setLabel('Confirm Email');
     $confirmEmail->addValidators(array(new PresenceOf(array('message' => 'The confirmation e-mail is required'))));
     $this->add($confirmEmail);
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required')), new StringLength(array('min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters')), new Confirmation(array('message' => 'Password doesn\'t match confirmation', 'with' => 'confirmPassword'))));
     $this->add($password);
     // Confirm Password
     $confirmPassword = new Password('confirmPassword', array('placeholder' => 'Confirm Password'));
     $confirmPassword->setLabel('Confirm Password');
     $confirmPassword->addValidators(array(new PresenceOf(array('message' => 'The confirmation password is required'))));
     $this->add($confirmPassword);
     // Remember
     //		$terms = new Check('terms', array(
     //			'value' => 'yes'
     //		));//
     //		$terms->setLabel('Accept terms and conditions');
     //
     //		$terms->addValidator(new Identical(array(
     //			'value' => 'yes',
     //			'message' => 'Terms and conditions must be accepted'
     //		)));
     //
     //		$this->add($terms);
     // Sign Up
     $this->add(new Submit('Sign Up', array('class' => 'btn btn-success')));
 }
Example #5
0
 public function initialize()
 {
     parent::initialize();
     // Email
     $email = new Text('email', array('placeholder' => 'Email'));
     $email->setLabel('Email');
     $email->addValidators(array(new PresenceOf(array('message' => 'The e-mail is required')), new Email(array('message' => 'The e-mail is not valid'))));
     $this->add($email);
     // Password
     $password = new Password('password', array('placeholder' => 'Password'));
     $password->setLabel('Password');
     $password->addValidators(array(new PresenceOf(array('message' => 'The password is required'))));
     $this->add($password);
     // Remember
     $remember = new Check('remember', array('value' => 'yes'));
     $remember->setLabel('Remember me');
     $this->add($remember);
     // Sign Up
     $this->add(new Submit('Login', array('class' => 'btn btn-success')));
 }