/** * Generates control's HTML element. * @return NHtml */ public function getControl() { $control = parent::getControl(); foreach ($this->getRules() as $rule) { if ($rule->isNegative || $rule->type !== NRule::VALIDATOR) { } elseif ($rule->operation === NForm::RANGE && $control->type !== 'text') { list($control->min, $control->max) = $rule->arg; } elseif ($rule->operation === NForm::PATTERN) { $control->pattern = $rule->arg; } } if ($control->type !== 'password') { $control->value = $this->getValue() === '' ? $this->translate($this->emptyValue) : $this->value; } return $control; }
public function getControl($label = NULL) { return parent::getControl(); }
public function getInput() { $control = parent::getControl(); $control->value = $this->value === '' ? $this->emptyValue : $this->tmpValue; return $control; }
/** * Generates control's HTML element. * @return NHtml */ public function getControl() { $control = parent::getControl(); $control->setText($this->getValue() === '' ? $this->translate($this->emptyValue) : $this->value); return $control; }
/** * Rangle validator: is a control's value number in specified range? * @param NTextBase * @param array min and max value pair * @return bool */ public static function validateRange(NTextBase $control, $range) { return NValidators::isInRange($control->getValue(), $range); }
function notifyRule(NRule $rule) { if (is_string($rule->operation) && strcasecmp($rule->operation, ':length') === 0 && !$rule->isNegative) { $this->control->maxlength = is_array($rule->arg) ? $rule->arg[1] : $rule->arg; } elseif (is_string($rule->operation) && strcasecmp($rule->operation, ':maxLength') === 0 && !$rule->isNegative) { $this->control->maxlength = $rule->arg; } parent::notifyRule($rule); }