예제 #1
0
 * When adding new fields first add HTML to your form then simply
 * copy/paste PHP below and modify to match your new field
 */
/* NAME */
$name = new iPhorm_Element('name');
// Create the name element - name must be the same as the name attribute of your form element in the HTML
$name->addFilter('trim');
// Add the Trim filter to the element
$name->addValidator('required');
// Add the Required validator to the element (makes the field required)
$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