Class TRangeValidator

Description

TRangeValidator class

TRangeValidator tests whether an input value is within a specified range.

TRangeValidator uses three key properties to perform its validation. The MinValue and MaxValue properties specify the minimum and maximum values of the valid range. The DataType property is used to specify the data type of the value and the minimum and maximum range values. These values are converted to this data type before the validation operation is performed. The following value types are supported:

  • Integer A 32-bit signed integer data type.
  • Float A double-precision floating point number data type.
  • Date A date data type. The date format can be specified by setting DateFormat property, which must be recognizable by TSimpleDateFormatter. If the property is not set, the GNU date syntax is assumed.
  • String A string data type.
  • StringLength check for string length.
If StrictComparison is true, then the ranges are compared as strictly less than the max value and/or strictly greater than the min value.

The TRangeValidator allows a special DataType "StringLength" that can be used to verify minimum and maximum string length. The Charset property can be used to force a particular charset for comparison. Otherwise, the application charset is used and is defaulted as UTF-8.

  • since: 3.0
  • version: $Id: TRangeValidator.php 2381 2008-02-22 17:53:43Z tof $
  • author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/WebControls/TRangeValidator.php (line 53)

TComponent
   |
   --TApplicationComponent
      |
      --TControl
         |
         --TWebControl
            |
            --TLabel
               |
               --TBaseValidator
                  |
                  --TRangeValidator
Method Summary
boolean evaluateIsValid ()
string getCharset ()
string getClientClassName ()
string getDateFormat ()
string getMaxValue ()
string getMinValue ()
boolean getStrictComparison ()
void isGreaterThan (mixed $left, mixed $right)
void isLessThan (mixed $left, mixed $right)
boolean isValidDate (string $value)
boolean isValidFloat (string $value)
boolean isValidInteger (string $value)
boolean isValidString (string $value)
boolean isValidStringLength (string $value)
void setCharset (string $value)
void setDateFormat (string $value)
void setMaxValue (string $value)
void setMinValue (string $value)
void setStrictComparison (boolean $value)
Methods
evaluateIsValid (line 172)

This method overrides the parent's implementation.

The validation succeeds if the input data is within the range. The validation always succeeds if the input data is empty.

  • return: whether the validation succeeds
  • access: protected
boolean evaluateIsValid ()

Redefinition of:
TBaseValidator::evaluateIsValid()
This is the major method for validation.
getCharset (line 161)
  • return: charset for string length comparison.
  • access: public
string getCharset ()
getClientClassName (line 60)

Gets the name of the javascript class responsible for performing validation for this control.

This method overrides the parent implementation.

  • return: the javascript class name
  • access: protected
string getClientClassName ()

Redefinition of:
TBaseValidator::getClientClassName()
Gets the name of the javascript class responsible for performing validation for this control.
getClientScriptOptions (line 326)

Returns an array of javascript validator options.

  • return: javascript validator options.
  • access: protected
array getClientScriptOptions ()

Redefinition of:
TBaseValidator::getClientScriptOptions()
Returns an array of javascript validator options.
getDataType (line 119)
  • return: the data type that the values being compared are converted to before the comparison is made. Defaults to TRangeValidationDataType::String.
  • access: public
TRangeValidationDataType getDataType ()
getDateFormat (line 145)
  • return: the date validation date format if any
  • access: public
string getDateFormat ()
getMaxValue (line 85)
  • return: the maximum value of the validation range.
  • access: public
string getMaxValue ()
getMinValue (line 68)
  • return: the minimum value of the validation range.
  • access: public
string getMinValue ()
getStrictComparison (line 110)
  • return: true to perform strict comparison.
  • access: public
boolean getStrictComparison ()
isGreaterThan (line 217)
  • access: protected
void isGreaterThan (mixed $left, mixed $right)
isLessThan (line 212)
  • access: protected
void isLessThan (mixed $left, mixed $right)
isValidDate (line 247)

Determine if the date is within the specified range.

Uses pradoParseDate and strtotime to get the date from string.

  • return: true if within range.
  • access: protected
boolean isValidDate (string $value)
  • string $value: date as string to validate
isValidFloat (line 227)

Determine if the value is within the specified float range.

  • return: true if within range.
  • access: protected
boolean isValidFloat (string $value)
  • string $value: value to validate
isValidInteger (line 198)

Determine if the value is within the integer range.

  • return: true if within integer range.
  • access: protected
boolean isValidInteger (string $value)
  • string $value: value to validate true
isValidString (line 282)

Compare the string with a minimum and a maxiumum value.

Uses strcmp for comparision.

  • return: true if the string is within range.
  • access: protected
boolean isValidString (string $value)
  • string $value: value to compare with.
isValidStringLength (line 299)
  • return: true if min and max string length are satisfied.
  • access: protected
boolean isValidStringLength (string $value)
  • string $value: string for comparision
setCharset (line 153)
  • access: public
void setCharset (string $value)
  • string $value: charset for string length comparison.
setDataType (line 128)

Sets the data type that the values being compared are converted to before the comparison is made.

  • access: public
void setDataType (TRangeValidationDataType $value)
setDateFormat (line 137)

Sets the date format for a date validation

  • access: public
void setDateFormat (string $value)
  • string $value: the date format value
setMaxValue (line 94)

Sets the maximum value of the validation range.

  • access: public
void setMaxValue (string $value)
  • string $value: the maximum value
setMinValue (line 77)

Sets the minimum value of the validation range.

  • access: public
void setMinValue (string $value)
  • string $value: the minimum value
setStrictComparison (line 102)
  • access: public
void setStrictComparison (boolean $value)
  • boolean $value: true to perform strict comparison (i.e. strictly less than max and/or strictly greater than min).

Inherited Methods

Inherited From TBaseValidator

TBaseValidator::__construct()
TBaseValidator::addAttributesToRender()
TBaseValidator::createClientSide()
TBaseValidator::evaluateIsValid()
TBaseValidator::getClientClassName()
TBaseValidator::getClientScriptOptions()
TBaseValidator::getClientSide()
TBaseValidator::getControlCssClass()
TBaseValidator::getControlToValidate()
TBaseValidator::getDisplay()
TBaseValidator::getEnableClientScript()
TBaseValidator::getErrorMessage()
TBaseValidator::getFocusElementID()
TBaseValidator::getFocusOnError()
TBaseValidator::getIsValid()
TBaseValidator::getValidationGroup()
TBaseValidator::getValidationTarget()
TBaseValidator::getValidationValue()
TBaseValidator::onInit()
TBaseValidator::onPreRender()
TBaseValidator::onUnload()
TBaseValidator::onValidate()
TBaseValidator::onValidationError()
TBaseValidator::onValidationSuccess()
TBaseValidator::registerClientScriptValidator()
TBaseValidator::renderClientControlScript()
TBaseValidator::renderContents()
TBaseValidator::setControlCssClass()
TBaseValidator::setControlToValidate()
TBaseValidator::setDisplay()
TBaseValidator::setEnableClientScript()
TBaseValidator::setEnabled()
TBaseValidator::setErrorMessage()
TBaseValidator::setFocusElementID()
TBaseValidator::setFocusOnError()
TBaseValidator::setForControl()
TBaseValidator::setIsValid()
TBaseValidator::setValidationGroup()
TBaseValidator::updateControlCssClass()
TBaseValidator::validate()

Inherited From TLabel

TLabel::addAttributesToRender()
TLabel::getData()
TLabel::getForControl()
TLabel::getTagName()
TLabel::getText()
TLabel::render()
TLabel::renderContents()
TLabel::setData()
TLabel::setForControl()
TLabel::setText()

Inherited From TWebControl

TWebControl::addAttributesToRender()
TWebControl::clearStyle()
TWebControl::copyBaseAttributes()
TWebControl::createStyle()
TWebControl::getAccessKey()
TWebControl::getBackColor()
TWebControl::getBorderColor()
TWebControl::getBorderStyle()
TWebControl::getBorderWidth()
TWebControl::getCssClass()
TWebControl::getDisplay()
TWebControl::getFont()
TWebControl::getForeColor()
TWebControl::getHasStyle()
TWebControl::getHeight()
TWebControl::getStyle()
TWebControl::getTabIndex()
TWebControl::getTagName()
TWebControl::getToolTip()
TWebControl::getWidth()
TWebControl::render()
TWebControl::renderBeginTag()
TWebControl::renderContents()
TWebControl::renderEndTag()
TWebControl::setAccessKey()
TWebControl::setBackColor()
TWebControl::setBorderColor()
TWebControl::setBorderStyle()
TWebControl::setBorderWidth()
TWebControl::setCssClass()
TWebControl::setDisplay()
TWebControl::setForeColor()
TWebControl::setHeight()
TWebControl::setStyle()
TWebControl::setTabIndex()
TWebControl::setToolTip()
TWebControl::setWidth()

Inherited From TControl

TControl::__construct()
TControl::addedControl()
TControl::addParsedObject()
TControl::addToPostDataLoader()
TControl::applyStyleSheetSkin()
TControl::autoBindProperty()
TControl::autoDataBindProperties()
TControl::bindProperty()
TControl::broadcastEvent()
TControl::bubbleEvent()
TControl::clearChildState()
TControl::clearControlState()
TControl::clearNamingContainer()
TControl::clearViewState()
TControl::convertUniqueIdToClientId()
TControl::createChildControls()
TControl::createControlCollection()
TControl::dataBind()
TControl::dataBindChildren()
TControl::dataBindProperties()
TControl::ensureChildControls()
TControl::findControl()
TControl::findControlsByID()
TControl::findControlsByType()
TControl::focus()
TControl::getAdapter()
TControl::getAllowChildControls()
TControl::getAttribute()
TControl::getAttributes()
TControl::getChildControlsCreated()
TControl::getClientID()
TControl::getControls()
TControl::getControlStage()
TControl::getControlState()
TControl::getCustomData()
TControl::getEnabled()
TControl::getEnableTheming()
TControl::getEnableViewState()
TControl::getHasAdapter()
TControl::getHasAttributes()
TControl::getHasChildInitialized()
TControl::getHasControls()
TControl::getHasInitialized()
TControl::getHasLoaded()
TControl::getHasLoadedPostData()
TControl::getHasPreRendered()
TControl::getID()
TControl::getNamingContainer()
TControl::getPage()
TControl::getParent()
TControl::getRegisteredObject()
TControl::getSkinID()
TControl::getSourceTemplateControl()
TControl::getTemplateControl()
TControl::getUniqueID()
TControl::getViewState()
TControl::getVisible()
TControl::hasAttribute()
TControl::initRecursive()
TControl::isDescendentOf()
TControl::isObjectRegistered()
TControl::loadRecursive()
TControl::loadState()
TControl::loadStateRecursive()
TControl::onDataBinding()
TControl::onInit()
TControl::onLoad()
TControl::onPreRender()
TControl::onUnload()
TControl::preRenderRecursive()
TControl::raiseBubbleEvent()
TControl::registerObject()
TControl::removeAttribute()
TControl::removedControl()
TControl::render()
TControl::renderChildren()
TControl::renderControl()
TControl::saveState()
TControl::saveStateRecursive()
TControl::setAdapter()
TControl::setAttribute()
TControl::setChildControlsCreated()
TControl::setControlStage()
TControl::setControlState()
TControl::setCustomData()
TControl::setEnabled()
TControl::setEnableTheming()
TControl::setEnableViewState()
TControl::setID()
TControl::setPage()
TControl::setSkinID()
TControl::setTemplateControl()
TControl::setViewState()
TControl::setVisible()
TControl::trackViewState()
TControl::traverseChildControls()
TControl::unbindProperty()
TControl::unloadRecursive()
TControl::unregisterObject()
TControl::__get()

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

Inherited From TComponent

TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__get()
TComponent::__set()
Class Constants

Documentation generated on Mon, 21 Apr 2008 11:35:56 -0400 by phpDocumentor 1.3.0RC4