예제 #1
0
$form->addElement($name);
// Add the element to the form
/* EMAIL */
$email = new iPhorm_Element('email');
$email->addFilter('trim');
$email->addValidators(array('required', 'email'));
$form->addElement($email);
/* PHONE */
$phone = new iPhorm_Element('phone');
$phone->addFilter('trim');
$form->addElement($phone);
/* MESSAGE (TEXTAREA) */
$message = new iPhorm_Element('message');
$message->addFilter('trim');
$message->addValidator('required');
$form->addElement($message);
/* -----------------
 * CAPTCHA 
  ------------------- */
$captcha = new iPhorm_Element('type_the_word');
// Create the type_the_word (captcha) element - type_the_word must be the same as the name attribute of your form element in the HTML
$captcha->addFilter('trim');
// Add the Trim filter to the element
$captcha->addValidator('required');
// Add the Required validator to the element
$captcha->addValidator('identical', array('token' => 'light'));
// Add Identical validator value must match the word light
$captcha->setSkipRender(true);
// Success handlers should not render the element
$form->addElement($captcha);
// Add the element to the form