70 parent::setDefaults();
72 $this->defaults[
'defaultValue'] = 0;
73 $this->defaults[
'min'] =
null;
74 $this->defaults[
'max'] =
null;
75 $this->defaults[
'step'] =
null;
76 $this->defaults[
'errorMessage'] = _(
'Please enter a valid number');
87 $type = strtolower($this->type);
90 $label = $this->htmlLabel();
99 return "<p {$wrapperAttributes}>" .
101 "<span class=\"depage-label\">{$label}{$marker}</span>" .
102 "<input name=\"{$this->name}\" type=\"{$type}\"{$max}{$min}{$step}{$inputAttributes} value=\"{$value}\">" .
117 return ($this->min ===
null) ?
"" :
" min=\"" . $this->
htmlEscape($this->min) .
"\"";
127 return ($this->max ===
null) ?
"" :
" max=\"" . $this->
htmlEscape($this->max) .
"\"";
137 return ($this->step ===
null) ?
"" :
" step=\"" . $this->
htmlEscape($this->step) .
"\"";
154 return $this->validator->validate($this->value, $parameters);
168 $pString = str_replace(
" ",
"", $ptString);
171 if (substr_count($pString,
",") > 1) {
172 $pString = str_replace(
",",
"", $pString);
174 if (substr_count($pString,
".") > 1) {
175 $pString = str_replace(
".",
"", $pString);
179 $commaset = strrpos($pString,
',');
180 $pointset = strrpos($pString,
'.');
183 if ($commaset > $pointset) {
184 $pString = str_replace(
".",
"", $pString);
185 }
else if ($commaset < $pointset) {
186 $pString = str_replace(
",",
"", $pString);
190 $pString = str_replace(
",",
".", $pString);
192 if ($pString !==
"" && preg_match(
"/^[-+]?\d*\.?\d*$/", $pString)) {
193 $this->value = (float) $pString;
211 if ($this->step !==
null && ($pos = strpos($this->step,
".")) !==
false) {
212 $decimals = strlen(substr($this->step, $pos + 1));
215 return number_format($this->
getValue(), $decimals,
'.',
'');
228 && $this->value !== 0
229 && $this->value !== .0
htmlEscape($options=array())
Escapes HTML in strings and arrays of strings.
$value
Input elements's value.
$label
Input element - HTML label.
$errorMessage
Message that gets displayed in case of invalid input.
htmlHelpMessage()
Returns HTML-rendered helpMessage.
htmlWrapperAttributes()
Returns string of HTML attributes for element wrapper paragraph.
htmlMarker()
Returns elements' required-indicator.
$type
Input element type - HTML input type attribute.
$helpMessage
Extra help message.
htmlValue()
Returns HTML-rendered element value.
$marker
Input element - HTML marker text that marks required fields.
getValue()
Returns the current input elements' value.
htmlErrorMessage()
Returns HTML-rendered error message.
htmlMax()
Renders HTML max attribute.
getStringValue()
getStringValue
typeCastValue()
Converts value to element specific type.
htmlMin()
Renders HTML min attribute.
$min
Minimum range HTML attribute.
__toString()
Renders element to HTML.
$step
Step HTML attribute.
validatorCall()
custom validator call
$max
Maximum range HTML attribute.
setDefaults()
collects initial values across subclasses.
htmlStep()
Renders HTML step attribute.
isEmpty()
custom empty check
htmlInputAttributes()
renders text element specific HTML attributes
htmlList($options=null)
Renders HTML datalist.
Classes for HTML input-elements.