Framework
3.9
|
Field renderer for numeric data fields. More...
Public Member Functions | |
NumberFieldRenderer (&$parent, $field=null) | |
addValidatorsToForm ($field, $required=false) | |
This method is called by the AutoForm to add any default input validators that are required by the FieldRenderer. More... | |
setUnits ($units, $position) | |
Sets the displayed units and their position. More... | |
setRange ($min, $max, $step=1) | |
Specifies that the field should be rendered with a "number" HTML control with the supplied range and step. More... | |
renderField ($field) | |
FieldRenderers must override this method to provide the HTML implementation of the control used to edit the field. More... | |
renderReadOnly ($field) | |
preProcess ($field="") | |
FieldRenderers can override this method to provide behavior that occurs prior to the saving of the parent form's target object to the database. More... | |
Public Member Functions inherited from FieldRenderer | |
FieldRenderer ($parent) | |
Constructor. More... | |
_printLabel ($field, $colspan=1, $styles="", $annotation="") | |
Internal method to generate the HTML for the field label. More... | |
_getLabel ($field, $addSuffix=true) | |
_startField ($field, $styles="") | |
Internal method to generate the starting HTML for the field (including the label) More... | |
_endField ($field) | |
Internal method to generate the closing HTML for the field. More... | |
addSearchValidatorsToForm ($field, $mode, $required=false) | |
For SearchForm, the validator field needs to match the name tag in the form which is in the format field:mode. More... | |
formatName ($item, $name) | |
Formats the given DataItem based on the supplied format string. More... | |
renderScript ($field) | |
FieldRenderers can override this method to provide any Javascript that their control requires for an edit form. More... | |
renderSearchScript ($field, $mode) | |
FieldRenderers can override this method to provide any Javascript that the control requires when being used in a search form. More... | |
renderSearchField ($field, $mode) | |
FieldRenderers must override this method to provide the HTML implementation of the control displayed for the field in a search form. More... | |
renderOnSubmitHandler ($field) | |
FieldRenderers can override this method to provide any Javascript that must be executed when the form is submitted on the client. More... | |
postProcess ($field="") | |
FieldRenderers can override this method to provide behavior that occurs after the parent form's target object has been saved to the database. More... | |
Public Attributes | |
$allowNegative = false | |
Whether user can enter a negative number. More... | |
$autocomplete = true | |
Whether the browser is allowed to show autocomplete for this field. More... | |
$size = 15 | |
Size of the displayed control in characters. More... | |
$onKeyUp | |
optional javascript callback function for key up events More... | |
$disable = false | |
alternative to readonly; field can be reenabled or set thru javascript More... | |
$onChange = "" | |
optional javascript callback on data input change More... | |
$units = "" | |
units text to display More... | |
$unitsPosition = "" | |
whether to display units before or after the control More... | |
$blankZero = false | |
Leave field blank if value is zero. More... | |
$control = "text" | |
The HTML control type to use when rendering. This gets set to "number" if a range is specified. More... | |
$static = false | |
Render the field as a static (readonly) value, that is visible, non-editable and the value is submitted when the form is submitted. More... | |
Public Attributes inherited from FieldRenderer | |
$parent = null | |
$labelSuffix = "" | |
$colspan = 1 | |
$annotateBefore = false | |
$annotateNextLine = true | |
$hideLabel = false | |
$onPreProcess = null | |
callback hook for processing prior to saving the form's data object - individual renderers may override with custom processing More... | |
$onPostProcess = null | |
callback hook for processing after saving the form's data object - individual renderers may override with custom processing More... | |
Field renderer for numeric data fields.
Renders as a text box with numerically masked input (user cannot enter non-numeric characters).
Allow negative defaults to false; if a field should allow negative numbers, calling script should add the following line: $form->getRenderer("field_name")->allowNegative = true;
Definition at line 48 of file number_field_renderer.inc.
NumberFieldRenderer::addValidatorsToForm | ( | $field, | |
$required = false |
|||
) |
This method is called by the AutoForm to add any default input validators that are required by the FieldRenderer.
Fields that need custom validation or a custom required validator should override this function.
string | $field | the field name |
boolean | $required | - whether the field is required |
Reimplemented from FieldRenderer.
Definition at line 72 of file number_field_renderer.inc.
NumberFieldRenderer::NumberFieldRenderer | ( | & | $parent, |
$field = null |
|||
) |
Definition at line 63 of file number_field_renderer.inc.
NumberFieldRenderer::preProcess | ( | $field = "" | ) |
FieldRenderers can override this method to provide behavior that occurs prior to the saving of the parent form's target object to the database.
For example, the FileUploadFieldRenderer overrides this method to process the uploading of the file and then store the location in the associated field in the target object.
string | $field | the field name |
Reimplemented from FieldRenderer.
Definition at line 168 of file number_field_renderer.inc.
NumberFieldRenderer::renderField | ( | $field | ) |
FieldRenderers must override this method to provide the HTML implementation of the control used to edit the field.
string | $field | the field name |
Reimplemented from FieldRenderer.
Definition at line 113 of file number_field_renderer.inc.
NumberFieldRenderer::renderReadOnly | ( | $field | ) |
Definition at line 153 of file number_field_renderer.inc.
NumberFieldRenderer::setRange | ( | $min, | |
$max, | |||
$step = 1 |
|||
) |
Specifies that the field should be rendered with a "number" HTML control with the supplied range and step.
mixed | $min | the minimum value for the field |
mixed | $max | the maximum value for the field |
mixed | $step | the amount to step when the spinner up/down buttons are clicked |
Definition at line 103 of file number_field_renderer.inc.
NumberFieldRenderer::setUnits | ( | $units, | |
$position | |||
) |
Sets the displayed units and their position.
string | $units | |
string | $position |
Definition at line 89 of file number_field_renderer.inc.
NumberFieldRenderer::$allowNegative = false |
Whether user can enter a negative number.
Definition at line 51 of file number_field_renderer.inc.
NumberFieldRenderer::$autocomplete = true |
Whether the browser is allowed to show autocomplete for this field.
Definition at line 52 of file number_field_renderer.inc.
NumberFieldRenderer::$blankZero = false |
Leave field blank if value is zero.
Definition at line 59 of file number_field_renderer.inc.
NumberFieldRenderer::$control = "text" |
The HTML control type to use when rendering. This gets set to "number" if a range is specified.
Definition at line 60 of file number_field_renderer.inc.
NumberFieldRenderer::$disable = false |
alternative to readonly; field can be reenabled or set thru javascript
Definition at line 55 of file number_field_renderer.inc.
NumberFieldRenderer::$onChange = "" |
optional javascript callback on data input change
Definition at line 56 of file number_field_renderer.inc.
NumberFieldRenderer::$onKeyUp |
optional javascript callback function for key up events
Definition at line 54 of file number_field_renderer.inc.
NumberFieldRenderer::$size = 15 |
Size of the displayed control in characters.
Definition at line 53 of file number_field_renderer.inc.
NumberFieldRenderer::$static = false |
Render the field as a static (readonly) value, that is visible, non-editable and the value is submitted when the form is submitted.
Definition at line 61 of file number_field_renderer.inc.
NumberFieldRenderer::$units = "" |
units text to display
Definition at line 57 of file number_field_renderer.inc.
NumberFieldRenderer::$unitsPosition = "" |
whether to display units before or after the control
Definition at line 58 of file number_field_renderer.inc.