예제 #1
0
 /**
  * Class constructor
  *
  * @param string $name
  * @param string $label
  * @param array $options
  */
 public function __construct($name, $label = '', $options = null)
 {
     parent::__construct($name, $label);
     if (is_array($options)) {
         if (array_key_exists('timeFormat', $options)) {
             $this->setTimeFormat($options['timeFormat']);
         }
     }
 }
예제 #2
0
 /**
  * Class constructor
  *
  * @param string $name
  * @param string $label
  * @param array $options
  */
 public function __construct($name, $label = '', $options = null)
 {
     parent::__construct($name, $label);
     $this->_fileUploadValidator = new Quform_Validator_FileUpload(array('name' => $this->getName()));
     $this->addValidator($this->_fileUploadValidator);
     if (is_array($options)) {
         if (array_key_exists('allowedExtensions', $options)) {
             $this->_fileUploadValidator->setAllowedExtensions($options['allowedExtensions']);
         }
         if (array_key_exists('maximumFileSize', $options)) {
             $this->_fileUploadValidator->setMaxFileSize($options['maximumFileSize']);
         }
         if (array_key_exists('required', $options)) {
             $this->_fileUploadValidator->setRequired($options['required']);
         }
         if (array_key_exists('attach', $options)) {
             $this->setAttach($options['attach']);
         }
         if (array_key_exists('save', $options)) {
             $this->setSave($options['save']);
         }
     }
 }
예제 #3
0
 /**
  * Add a single element to the form
  *
  * @param $element Quform_Element The element to add
  * @return Quform
  */
 public function addElement(Quform_Element $element)
 {
     $element->setForm($this);
     $this->_elements[$element->getName()] = $element;
     return $this;
 }
$form->addElement($email);
/**
 * Configure the message element
 * Filters: Trim
 * Validators: Required
 */
$message = new Quform_Element('message', 'Message');
$message->addFilter('trim');
$message->addValidator('required');
$form->addElement($message);
/**
 * Configure the CAPTCHA element (REMOVE ""//"" ON LINES 215/216 WHEN YOU START GETTING SPAM)!!!!
 * Filters: Trim
 * Validators: Required, Identical
 */
$captcha = new Quform_Element('type_the_word', 'Type the word');
$captcha->addFilter('trim');
//$captcha->addValidator('required');
//$captcha->addValidator('identical', array('token' => 'catch'));
$captcha->setIsHidden(true);
$form->addElement($captcha);
/** END FORM ELEMENT CONFIGURATION **/
function process(Quform $form, array &$config)
{
    // Process the form
    if ($form->isValid($_POST)) {
        // Custom code section #1 - see documentation for examples
        // End custom code section #1
        try {
            $attachments = array();
            $elements = $form->getElements();
예제 #5
0
$form->addElement($email);
/**
 * Configure the message element
 * Filters: Trim
 * Validators: Required
 */
$message = new Quform_Element('message', 'Message');
$message->addFilter('trim');
$message->addValidator('required');
$form->addElement($message);
/**
 * Configure the CAPTCHA element
 * Filters: Trim
 * Validators: Required, Identical
 */
$captcha = new Quform_Element('type_the_word', 'Type the word');
$captcha->addFilter('trim');
$captcha->addValidator('required');
$captcha->addValidator('identical', array('token' => 'catch'));
$captcha->setIsHidden(true);
$form->addElement($captcha);
/** END FORM ELEMENT CONFIGURATION **/
function process(Quform $form, array &$config)
{
    // Process the form
    if ($form->isValid($_POST)) {
        // Custom code section #1 - see documentation for examples
        // End custom code section #1
        try {
            $attachments = array();
            $elements = $form->getElements();
/** FORM ELEMENT CONFIGURATION **/
/**
 * Configure the first name element
 * Filters: Trim
 * Validators: Required
 */
$firstName = new Quform_Element('full_name', 'Name');
$firstName->addFilter('trim');
$firstName->addValidator('required');
$form->addElement($firstName);
/**
 * Configure the email address element
 * Filters: Trim
 * Validators: Required, Email
 */
$emailAddress = new Quform_Element('email', 'Email address');
$emailAddress->addFilter('trim');
$emailAddress->addValidators(array('required', 'email'));
$form->addElement($emailAddress);
/** END FORM ELEMENT CONFIGURATION **/
function process(Quform $form, array &$config)
{
    // Process the form
    if ($form->isValid($_POST)) {
        // Custom code section #1 - see documentation for examples
        // End custom code section #1
        try {
            $attachments = array();
            $elements = $form->getElements();
            // Process uploaded files
            foreach ($elements as $element) {
$textInput3->addFilter('trim');
$textInput3->addValidator('required');
$form->addElement($textInput3);
$textInput4 = new Quform_Element('text_input4', 'Text input 4');
$textInput4->addFilter('trim');
$textInput4->addValidator('required');
$form->addElement($textInput4);
$textInput5 = new Quform_Element('text_input5', 'Text input 5');
$textInput5->addFilter('trim');
$textInput5->addValidator('required');
$form->addElement($textInput5);
$textInput6 = new Quform_Element('text_input6', 'Text input 6');
$textInput6->addFilter('trim');
$textInput6->addValidator('required');
$form->addElement($textInput6);
$textInput7 = new Quform_Element('text_input7', 'Text input 7');
$textInput7->addFilter('trim');
$textInput7->addValidator('required');
$form->addElement($textInput6);
$singleSelect = new Quform_Element('single_select', 'Single select');
$singleSelect->addValidator('required');
$form->addElement($singleSelect);
$subject = new Quform_Element('subject', 'Subject');
$subject->addFilter('trim');
$form->addElement($subject);
$multiSelect = new Quform_Element('multi_select[]', 'Multi select');
$multiSelect->addValidator('required');
$form->addElement($multiSelect);
$singleCheckbox = new Quform_Element('single_checkbox', 'Single checkbox');
$singleCheckbox->addValidator('required');
$form->addElement($singleCheckbox);