public function initialize()
 {
     // phone
     $phone = new Text('phone');
     $phone->setLabel('电话');
     $phone->setFilters(array('striptags', 'string'));
     $phone->addValidators(array(new PresenceOf(array('message' => 'phone is required'))));
     $this->add($phone);
     // Email
     $email = new Text('email');
     $email->setLabel('邮件');
     $email->setFilters('email');
     $this->add($email);
     $message = new TextArea('msg');
     $message->setLabel('建议');
     $message->setFilters(array('striptags', 'string'));
     $message->addValidators(array(new PresenceOf(array('message' => 'message is required'))));
     $this->add($message);
 }
Beispiel #2
0
 public function initialize($entity = null, $options = null)
 {
     // Name
     $name = new Text('name');
     $name->setLabel('Your Name');
     $name->setFilters(array('striptags', 'string'));
     $name->addValidators(array(new PresenceOf(array('message' => 'Name is required'))));
     $this->add($name);
     // Email
     $email = new Text('email');
     $email->setLabel('E-Mail');
     $email->setFilters('email');
     $email->addValidators(array(new PresenceOf(array('message' => 'E-mail is required')), new Email(array('message' => 'E-mail is not valid'))));
     $this->add($email);
     $comments = new TextArea('comments');
     $comments->setLabel('Comments');
     $comments->setFilters(array('striptags', 'string'));
     $comments->addValidators(array(new PresenceOf(array('message' => 'Comments is required'))));
     $this->add($comments);
 }