38 require_once realpath(dirname(__FILE__)).
"/../field_renderers.inc";
67 $value = htmlspecialchars($this->parent->data->get($field), ENT_QUOTES,
'UTF-8');
69 $value = floatval($value);
71 $value = $this->
format($field);
76 $onchange = (
$this->onChange) ?
"onchange='$this->onChange(this)'" :
"";
81 echo
"$ <input id='{$this->parent->id}_{$field}'
82 type='text' name='$field' value='{$value}' $autocomplete onkeypress='return maskInput(event, $allowneg);'
83 $onchange $onKeyUp $disable $readonly size='{$this->size}'/>";
92 $from = htmlspecialchars($this->parent->params->get($field,
"from"), ENT_QUOTES,
'UTF-8');
93 $to = htmlspecialchars($this->parent->params->get($field,
"to"), ENT_QUOTES,
'UTF-8');
97 echo
"<td>From <input type='text' name='$field:from' value='{$from}' size='20'> to <input type='text' name='$field:to' value='{$to}' size='20'></td>\n";
102 $value = htmlspecialchars($this->parent->params->get($field, $mode), ENT_QUOTES,
'UTF-8');
105 echo
"<td><input type='text' name='$field:$mode' value='{$value}' size='20'></td>\n";
114 echo
"$". $this->
format($field);
122 if ($this->parent->readOnlyForm || $this->parent->isReadOnly($field) || array_key_exists($field, $this->parent->hidden))
return "";
124 $value= $_POST[$field];
125 $value = str_replace(
",",
"", $value);
126 $this->parent->data->set($field, $value);
127 $_POST[$field] = $value;
132 $label = isset($this->label) ? $this->label : $this->parent->prettifyFieldName($field);
144 if ($this->parent->isReadOnly($field))
return "";
146 echo
"\tdocument.id('{$this->parent->id}_{$field}').value = rawNumber(document.id('{$this->parent->id}_{$field}').value);\n";
Use Currency3 if you want to have 3 decimal places displayed.
Currency3FieldRenderer(&$parent)
Field renderer for currency data fields.
$onKeyUp
optional javascript callback on key release within field
$allowNegative
Whether user can enter a negative number.
preProcess($field="")
FieldRenderers can override this method to provide behavior that occurs prior to the saving of the pa...
renderScript($field)
FieldRenderers can override this method to provide any Javascript that their control requires for an ...
renderSearchField($field, $mode="equal")
FieldRenderers must override this method to provide the HTML implementation of the control displayed ...
$autocomplete
Whether the browser is allowed to show autocomplete for this field.
CurrencyFieldRenderer(&$parent)
$disable
alternative to readonly; field can be reenabled thru javascript
renderOnSubmitHandler($field)
FieldRenderers can override this method to provide any Javascript that must be executed when the form...
$static
Render the field as a static (readonly) value, that is visible, non-editable and the value is submitt...
$onChange
optional javascript callback on data input change
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
addValidatorsToForm($field, $required=false)
This method is called by the AutoForm to add any default input validators that are required by the Fi...
$template
how to format readonly - 2 decimal places
$size
size of the text field to be displayed (in characters)
static format($value, $template="")
FieldRenderer is the abstract base class for all FieldRenderers.
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
_printLabel($field, $colspan=1, $styles="", $annotation="")
Internal method to generate the HTML for the field label.
FieldRenderer($parent)
Constructor.
RequiredCurrencyField Validator.