Esempio n. 1
0
 /**
  * Tells whether the form was already submitted
  *
  * This is useful since the _submitFiles and _submitValues arrays
  * may be completely empty after the trackSubmit value is removed.
  *
  * @return bool
  */
 function isSubmitted()
 {
     return parent::isSubmitted() && !$this->isFrozen();
 }
Esempio n. 2
0
 /**
  * Adds a validation rule for the given group of elements
  *
  * Only groups with a name can be assigned a validation rule
  * Use addGroupRule when you need to validate elements inside the group.
  * Use addRule if you need to validate the group as a whole. In this case,
  * the same rule will be applied to all elements in the group.
  * Use addRule if you need to validate the group against a function.
  *
  * @param    string     $group         Form group name
  * @param    mixed      $arg1          Array for multiple elements or error message string for one element
  * @param    string     $type          (optional)Rule type use getRegisteredRules() to get types
  * @param    string     $format        (optional)Required for extra rule data
  * @param    int        $howmany       (optional)How many valid elements should be in the group
  * @param    string     $validation    (optional)Where to perform validation: "server", "client"
  * @param    bool       $reset         Client-side: whether to reset the element's value to its original state if validation failed.
  * @since    2.5
  * @access   public
  * @throws   HTML_QuickForm_Error
  */
 function addGroupRule($group, $arg1, $type = '', $format = null, $howmany = 0, $validation = 'server', $reset = false)
 {
     parent::addGroupRule($group, $arg1, $type, $format, $howmany, $validation, $reset);
     if (is_array($arg1)) {
         foreach ($arg1 as $rules) {
             foreach ($rules as $rule) {
                 $validation = isset($rule[3]) && 'client' == $rule[3] ? 'client' : 'server';
                 if ('client' == $validation) {
                     $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_formName . '; } catch(e) { return true; } return myValidator(this);'));
                 }
             }
         }
     } elseif (is_string($arg1)) {
         if ($validation == 'client') {
             $this->updateAttributes(array('onsubmit' => 'try { var myValidator = validate_' . $this->_formName . '; } catch(e) { return true; } return myValidator(this);'));
         }
     }
 }