Example #1
0
	/**
	 * 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();
 }
Example #3
0
 public function getInput()
 {
     $control = parent::getControl();
     $control->value = $this->value === '' ? $this->emptyValue : $this->tmpValue;
     return $control;
 }
Example #4
0
	/**
	 * 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;
	}
Example #5
0
	/**
	 * 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);
	}
Example #6
0
File: loader.php Project: GE3/GE3
 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);
 }