74 |
|
|
75 |
|
|
76 |
/** |
/** |
77 |
* This function will return the |
* This method validates the data |
78 |
* elements value |
* for this Form Element. |
79 |
* |
* |
80 |
* @return mixed |
* It validates as is_name(). |
81 |
|
* @param FormValidation object. |
82 |
*/ |
*/ |
83 |
function get_value() { |
function validate(&$_FormValidation) { |
84 |
if ($this->_limit_char_count < 0) { |
if ($this->_limit_char_count > 0) { |
85 |
return $this->_value; |
$length = strlen($this->get_value()); |
86 |
} else { |
if ($length > $this->_limit_char_count) { |
87 |
return substr($this->_value, 0, $this->_limit_char_count); |
$_FormValidation->_error("INVALID_LENGTH_N"); |
88 |
|
$this->set_error_message( str_replace(array("XX_MAX", "XX_LENGTH"), |
89 |
|
array($this->_limit_char_count, $length), |
90 |
|
$_FormValidation->get_error_message() )); |
91 |
|
return FALSE; |
92 |
|
} |
93 |
} |
} |
94 |
|
return TRUE; |
95 |
} |
} |
96 |
|
|
97 |
|
|