Dojo/Form/Element/NumberTextBox.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Dojo  
Subpackage
Form_Element  

\Zend_Dojo_Form_Element_NumberTextBox

Package: Zend\Dojo\Form\Element
NumberTextBox dijit
Parent(s)
\Zend_Dojo_Form_Element_ValidationTextBox < \Zend_Dojo_Form_Element_TextBox < \Zend_Dojo_Form_Element_Dijit < \Zend_Form_Element
Children
\Zend_Dojo_Form_Element_CurrencyTextBox
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
\global\Zend_Dojo_Form_Element_ValidationTextBox  
Version
$Id: NumberTextBox.php 24593 2012-01-05 20:35:02Z matthew $  

Constants

Properties

>VPropertyprotectedarray $_allowedTypes = array('decimal', 'scientific', 'percent', 'currency')
Allowed numeric type formats
Default valuearray('decimal', 'scientific', 'percent', 'currency')Details
Type
array
>VPropertyprotectedbool $_isPartialRendering = false

This is to allow execution of logic inside the render() methods of child elements during the magic call while skipping the parent render() method.

Default valuefalseDetails
Type
bool
Inherited_from
\Zend_Form_Element::$$_isPartialRendering  
Inherited_from
\Zend_Dojo_Form_Element_Dijit::$$_isPartialRendering  
Inherited_from
\Zend_Dojo_Form_Element_TextBox::$$_isPartialRendering  
Inherited_from
\Zend_Dojo_Form_Element_ValidationTextBox::$$_isPartialRendering  
>VPropertypublicstring $helper = 'NumberTextBox'
Use NumberTextBox dijit view helper
Default value'NumberTextBox'Details
Type
string

Methods

methodpublic__call(string $method, array $args) : string

Call renderDecoratorName() to render a specific decorator.

Parameters
NameTypeDescription
$methodstring
$argsarray
Returns
TypeDescription
string
Throws
ExceptionDescription
\Zend_Form_Exceptionfor invalid decorator or invalid method call
methodpublic__construct(mixed $spec, mixed $options = null) : void

$spec may be: - string: name of element - array: options with which to configure element - Zend_Config: Zend_Config with options for configuring element

Parameters
NameTypeDescription
$specmixed
$optionsmixed
Throws
ExceptionDescription
\Zend_Form_Exceptionif no element name after initialization
methodpublic__get(string $key) : mixed

Prevents access to properties beginning with '_'.

Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
mixed
methodpublic__set(string $key, mixed $value) : \voide
Parameters
NameTypeDescription
$keystring
$valuemixed
Returns
TypeDescription
\voide
methodpublic__toString() : string

Proxies to render().

Returns
TypeDescription
string
methodprotected_castBoolToString(mixed $item, string $key) : void
inherited

Cast a boolean value to a string

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::_castBoolToString()
Parameters
NameTypeDescription
$itemmixed
$keystring
methodprotected_filterValue(string $value, string $key) : void
Parameters
NameTypeDescription
$valuestring
$keystring
methodprotected_getDecorator(string $name, null | array $options) : \Zend_Form_Decorator_Interface
Parameters
NameTypeDescription
$namestring
$optionsnull | array
Returns
TypeDescription
\Zend_Form_Decorator_Interface
methodprotected_getErrorMessages() : array
Returns
TypeDescription
array
methodprotected_loadDecorator(array $decorator, mixed $name) : \Zend_Form_Decorator_Interface
Parameters
NameTypeDescription
$decoratorarray

Decorator type and options

$namemixed

Decorator name or alias

Returns
TypeDescription
\Zend_Form_Decorator_Interface
methodprotected_loadValidator(array $validator) : \Zend_Validate_Interface
Parameters
NameTypeDescription
$validatorarray

Validator definition

Returns
TypeDescription
\Zend_Validate_Interface
methodpublicaddDecorator(string | \Zend_Form_Decorator_Interface $decorator, array | \Zend_Config $options = null) : \Zend_Form_Element
Parameters
NameTypeDescription
$decoratorstring | \Zend_Form_Decorator_Interface
$optionsarray | \Zend_Config

Options with which to initialize decorator

Returns
TypeDescription
\Zend_Form_Element
methodpublicaddDecorators(array $decorators) : \Zend_Form_Element
Parameters
NameTypeDescription
$decoratorsarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicaddError(string $message) : \Zend_Form_Element
Parameters
NameTypeDescription
$messagestring
Returns
TypeDescription
\Zend_Form_Element
methodpublicaddErrorMessage(string $message) : \Zend_Form_Element
Parameters
NameTypeDescription
$messagestring
Returns
TypeDescription
\Zend_Form_Element
methodpublicaddErrorMessages(array $messages) : \Zend_Form_Element
Parameters
NameTypeDescription
$messagesarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicaddErrors(array $messages) : \Zend_Form_Element
Parameters
NameTypeDescription
$messagesarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicaddFilter(string | \Zend_Filter_Interface $filter,  $options = array()) : \Zend_Form_Element
Parameters
NameTypeDescription
$filterstring | \Zend_Filter_Interface
$options
Returns
TypeDescription
\Zend_Form_Element
methodpublicaddFilters(array $filters) : \Zend_Form_Element
Parameters
NameTypeDescription
$filtersarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicaddPrefixPath(string $prefix, string $path, string $type = null) : \Zend_Form_Element

If no $type specified, assumes it is a base path for both filters and validators, and sets each according to the following rules: - decorators: $prefix = $prefix . '_Decorator' - filters: $prefix = $prefix . '_Filter' - validators: $prefix = $prefix . '_Validate'

Otherwise, the path prefix is set on the appropriate plugin loader.

Parameters
NameTypeDescription
$prefixstring
$pathstring
$typestring
Returns
TypeDescription
\Zend_Form_Element
Throws
ExceptionDescription
\Zend_Form_Exceptionfor invalid type
methodpublicaddValidator(string | \Zend_Validate_Interface $validator, bool $breakChainOnFailure = false, array $options = array()) : \Zend_Form_Element

Note: will overwrite existing validators if they are of the same class.

Parameters
NameTypeDescription
$validatorstring | \Zend_Validate_Interface
$breakChainOnFailurebool
$optionsarray
Returns
TypeDescription
\Zend_Form_Element
Throws
ExceptionDescription
\Zend_Form_Exceptionif invalid validator type
methodpublicaddValidators(array $validators) : \Zend_Form_Element
Parameters
NameTypeDescription
$validatorsarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicautoInsertNotEmptyValidator() : bool
Returns
TypeDescription
bool
methodpublicfilterName(string $value, bool $allowBrackets = false) : string
Parameters
NameTypeDescription
$valuestring
$allowBracketsbool
Returns
TypeDescription
string
methodpublicgetAttrib(string $name) : string
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
string
methodpublicgetConstraint(string $key) : mixed
inherited

Get an individual constraint

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::getConstraint()
Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
mixed
methodpublicgetConstraints() : array
inherited

Get constraints

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::getConstraints()
Returns
TypeDescription
array
methodpublicgetDecorator(string $name) : false | \Zend_Form_Decorator_Abstract
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
false | \Zend_Form_Decorator_Abstract
methodpublicgetDijitParam(string $key) : mixed
Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
mixed
methodpublicgetDijitParams() : array
Returns
TypeDescription
array
methodpublicgetFilter(string $name) : \Zend_Filter_Interface
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Filter_Interface
methodpublicgetFullyQualifiedName() : string

Places name as subitem of array and/or appends brackets.

Returns
TypeDescription
string
methodpublicgetIgnore() : bool
Returns
TypeDescription
bool
methodpublicgetInvalidMessage() : string | null
inherited

Retrieve invalidMessage

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::getInvalidMessage()
Returns
TypeDescription
string | null
methodpublicgetLocale() : string | null

Retrieve locale

Returns
TypeDescription
string | null
methodpublicgetLowercase() : bool
Returns
TypeDescription
bool
methodpublicgetMaxLength() : int | null
Returns
TypeDescription
int | null
methodpublicgetMessages() : array

The array keys are validation failure message identifiers, and the array values are the corresponding human-readable message strings.

If isValid() was never called or if the most recent isValid() call returned true, then this method returns an empty array.

Returns
TypeDescription
array
methodpublicgetPattern() : string | null

Retrieve numeric format pattern

Returns
TypeDescription
string | null
methodpublicgetPlaces() : int | null

Retrieve decimal places

Returns
TypeDescription
int | null
methodpublicgetPluginLoader(string $type) : \Zend_Loader_PluginLoader

Instantiates with default rules if none available for that type. Use 'decorator', 'filter', or 'validate' for $type.

Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
\Zend_Loader_PluginLoader
Throws
ExceptionDescription
\Zend_Loader_Exceptionon invalid type.
methodpublicgetPromptMessage() : string | null
inherited

Retrieve promptMessage

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::getPromptMessage()
Returns
TypeDescription
string | null
methodpublicgetPropercase() : bool
Returns
TypeDescription
bool
methodpublicgetRegExp() : string | null
inherited

Retrieve regExp

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::getRegExp()
Returns
TypeDescription
string | null
methodpublicgetStrict() : bool

Retrieve strict flag

Returns
TypeDescription
bool
methodpublicgetTrim() : bool
Returns
TypeDescription
bool
methodpublicgetType() : string | null

Retrieve type

Returns
TypeDescription
string | null
methodpublicgetUppercase() : bool
Returns
TypeDescription
bool
methodpublicgetValidator(string $name) : \Zend_Validate_Interface | false
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
\Zend_Validate_Interface | falseFalse if not found, validator otherwise
methodpublicgetView() : null | \Zend_View_Interface

Retrieves from ViewRenderer if none previously set.

Returns
TypeDescription
null | \Zend_View_Interface
methodpublichasConstraint(string $key) : bool
inherited

Is the given constraint set?

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::hasConstraint()
Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
bool
methodpublichasDijitParam(string $key) : bool
Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
bool
methodpublicisValid(mixed $value, mixed $context = null) : boolean

If a translation adapter is registered, any error messages will be translated according to the current locale, using the given error code; if no matching translation is found, the original message will be utilized.

Note: The filtered value is validated.

Parameters
NameTypeDescription
$valuemixed
$contextmixed
Returns
TypeDescription
boolean
Throws
ExceptionDescription
\Zend_Validate_ExceptionIf validation of $value is impossible
methodpublicremoveConstraint(string $key) : \Zend_Dojo_Form_Element_ValidationTextBox
inherited

Remove a single constraint

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::removeConstraint()
Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
\Zend_Dojo_Form_Element_ValidationTextBox
methodpublicremoveDijitParam(string $key) : \Zend_Dojo_Form_Element_Dijit
Parameters
NameTypeDescription
$keystring
Returns
TypeDescription
\Zend_Dojo_Form_Element_Dijit
methodpublicremoveValidator(string $name) : bool
Parameters
NameTypeDescription
$namestring
Returns
TypeDescription
bool
methodpublicrender(\Zend_View_Interface $view = null) : string
Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
string
methodpublicresolveElementId(\Zend_Form_Decorator_Interface $decorator) : string

Passed to the HtmlTag decorator as a callback in order to provide an ID.

Parameters
NameTypeDescription
$decorator\Zend_Form_Decorator_Interface
Returns
TypeDescription
string
methodpublicsetAllowEmpty(bool $flag) : \Zend_Form_Element

When the allow empty flag is enabled and the required flag is false, the element will validate with empty values.

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetAttrib(string $name, mixed $value) : \Zend_Form_Element
Parameters
NameTypeDescription
$namestring
$valuemixed
Returns
TypeDescription
\Zend_Form_Element
Throws
ExceptionDescription
\Zend_Form_Exceptionfor invalid $name values
methodpublicsetAttribs(array $attribs) : \Zend_Form_Element
Parameters
NameTypeDescription
$attribsarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetAutoInsertNotEmptyValidator(bool $flag) : \Zend_Form_Element
Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetBelongsTo(string $array) : \Zend_Form_Element
Parameters
NameTypeDescription
$arraystring
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetConstraint(string $key, mixed $value) : \Zend_Dojo_Form_Element_ValidationTextBox
inherited

Set an individual constraint

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::setConstraint()
Parameters
NameTypeDescription
$keystring
$valuemixed
Returns
TypeDescription
\Zend_Dojo_Form_Element_ValidationTextBox
methodpublicsetConstraints(array $constraints) : \Zend_Dojo_Form_Element_ValidationTextBox
inherited

Set validation constraints

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::setConstraints()

Refer to Dojo dijit.form.ValidationTextBox documentation for valid structure.

Parameters
NameTypeDescription
$constraintsarray
Returns
TypeDescription
\Zend_Dojo_Form_Element_ValidationTextBox
methodpublicsetDecorators(array $decorators) : \Zend_Form_Element
Parameters
NameTypeDescription
$decoratorsarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetDescription(string $description) : \Zend_Form_Element
Parameters
NameTypeDescription
$descriptionstring
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetDijitParam(string $key, mixed $value) : \Zend_Dojo_Form_Element_Dijit
Parameters
NameTypeDescription
$keystring
$valuemixed
Returns
TypeDescription
\Zend_Dojo_Form_Element_Dijit
methodpublicsetDijitParams(array $params) : \Zend_Dojo_Form_Element_Dijit
Parameters
NameTypeDescription
$paramsarray
Returns
TypeDescription
\Zend_Dojo_Form_Element_Dijit
methodpublicsetDisableTranslator(bool $flag) : \Zend_Form_Element
Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetErrorMessages(array $messages) : \Zend_Form_Element
Parameters
NameTypeDescription
$messagesarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetErrors(array $messages) : \Zend_Form_Element
Parameters
NameTypeDescription
$messagesarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetFilters(array $filters) : \Zend_Form_Element
Parameters
NameTypeDescription
$filtersarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetIgnore(bool $flag) : \Zend_Form_Element
Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetInvalidMessage(string $message) : \Zend_Dojo_Form_Element_ValidationTextBox
inherited

Set invalidMessage

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::setInvalidMessage()
Parameters
NameTypeDescription
$messagestring
Returns
TypeDescription
\Zend_Dojo_Form_Element_ValidationTextBox
methodpublicsetIsArray(bool $flag) : \Zend_Form_Element
Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetLocale(string $locale) : \Zend_Dojo_Form_Element_NumberTextBox

Set locale

Parameters
NameTypeDescription
$localestring
Returns
TypeDescription
\Zend_Dojo_Form_Element_NumberTextBox
methodpublicsetLowercase( $flag) : \Zend_Dojo_Form_Element_TextBox
Parameters
NameTypeDescription
$flag
Returns
TypeDescription
\Zend_Dojo_Form_Element_TextBox
methodpublicsetMaxLength(int $length) : \Zend_Dojo_Form_Element_TextBox
Parameters
NameTypeDescription
$lengthint
Returns
TypeDescription
\Zend_Dojo_Form_Element_TextBox
methodpublicsetOptions(array $options) : \Zend_Form_Element
Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetPattern(string $pattern) : \Zend_Dojo_Form_Element_NumberTextBox

Set numeric format pattern

Parameters
NameTypeDescription
$patternstring
Returns
TypeDescription
\Zend_Dojo_Form_Element_NumberTextBox
methodpublicsetPlaces(int $places) : \Zend_Dojo_Form_Element_NumberTextBox

Set decimal places

Parameters
NameTypeDescription
$placesint
Returns
TypeDescription
\Zend_Dojo_Form_Element_NumberTextBox
methodpublicsetPluginLoader(\Zend_Loader_PluginLoader_Interface $loader, string $type) : \Zend_Form_Element
Parameters
NameTypeDescription
$loader\Zend_Loader_PluginLoader_Interface
$typestring

'decorator', 'filter', or 'validate'

Returns
TypeDescription
\Zend_Form_Element
Throws
ExceptionDescription
\Zend_Form_Exceptionon invalid type
methodpublicsetPromptMessage(string $message) : \Zend_Dojo_Form_Element_ValidationTextBox
inherited

Set promptMessage

Inherited from: \Zend_Dojo_Form_Element_ValidationTextBox::setPromptMessage()
Parameters
NameTypeDescription
$messagestring
Returns
TypeDescription
\Zend_Dojo_Form_Element_ValidationTextBox
methodpublicsetPropercase( $flag) : \Zend_Dojo_Form_Element_TextBox
Parameters
NameTypeDescription
$flag
Returns
TypeDescription
\Zend_Dojo_Form_Element_TextBox
methodpublicsetRegExp(string $regexp) : \Zend_Dojo_Form_Element_ValidationTextBox
Parameters
NameTypeDescription
$regexpstring
Returns
TypeDescription
\Zend_Dojo_Form_Element_ValidationTextBox
methodpublicsetRequired(bool $flag = true) : \Zend_Form_Element
Parameters
NameTypeDescription
$flagbool

Default value is true

Returns
TypeDescription
\Zend_Form_Element
methodpublicsetStrict( $flag) : \Zend_Dojo_Form_Element_NumberTextBox

Set strict flag

Parameters
NameTypeDescription
$flag
Returns
TypeDescription
\Zend_Dojo_Form_Element_NumberTextBox
methodpublicsetTranslator(\Zend_Translate | null $translator = null) : \Zend_Form_Element
Parameters
NameTypeDescription
$translator\Zend_Translate | null
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetTrim( $flag) : \Zend_Dojo_Form_Element_TextBox
Parameters
NameTypeDescription
$flag
Returns
TypeDescription
\Zend_Dojo_Form_Element_TextBox
methodpublicsetType(string $type) : \Zend_Dojo_Form_Element_NumberTextBox

Set numeric format type

Parameters
NameTypeDescription
$typestring
Returns
TypeDescription
\Zend_Dojo_Form_Element_NumberTextBox
Details
See
\$_allowedTypes  
methodpublicsetUppercase( $flag) : \Zend_Dojo_Form_Element_TextBox
Parameters
NameTypeDescription
$flag
Returns
TypeDescription
\Zend_Dojo_Form_Element_TextBox
methodpublicsetValidators(array $validators) : \Zend_Form_Element
Parameters
NameTypeDescription
$validatorsarray
Returns
TypeDescription
\Zend_Form_Element
methodpublicsetView(\Zend_View_Interface $view = null) : \Zend_Dojo_Form_Element_Dijit

Ensures that the view object has the dojo view helper path set.

Parameters
NameTypeDescription
$view\Zend_View_Interface
Returns
TypeDescription
\Zend_Dojo_Form_Element_Dijit
Documentation was generated by phpDocumentor 2.0.0a12.