Zimlet JavaScript API Reference - DwtInputField

Class DwtInputField


Extends DwtComposite.

This class represents an input field..

CSS Elements

  • <className> input specifies the look of the input field during normal editing
  • <className>-error input specifies the look of the input field in an error state


Defined in: DwtInputField.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
DwtInputField(params)
Creates an input field.
Field Summary
Field Attributes Field Name and Description
<static>  
DwtInputField.CONTINUAL_VALIDATION
Validate field after each character is typed.
<static>  
DwtInputField.DATE
Defines the "Date input field" data type.
<static>  
DwtInputField.ERROR_ICON_LEFT
Defines the "left" error icon style.
<static>  
DwtInputField.ERROR_ICON_NONE
Defines the "none" error icon style.
<static>  
DwtInputField.ERROR_ICON_RIGHT
Defines the "right" error icon style.
<static>  
DwtInputField.FLOAT
Defines the "Numeric input field" data type.
<static>  
DwtInputField.INTEGER
Defines the "Integer input field (no floating point numbers)" data type.
<static>  
DwtInputField.MANUAL_VALIDATION
Validate the field manually.
<static>  
DwtInputField.NUMBER
Defines the "Integer or float input field" data type.
<static>  
DwtInputField.ONEXIT_VALIDATION
Validate the field (i.e.
<static>  
DwtInputField.PASSWORD
Defines the "Password input field" data type.
<static>  
DwtInputField.STRING
Defines the "String input field" data type.
Method Summary
Method Attributes Method Name and Description
 
applySubstitution(regex, replacement)
Applies a regular expression to the contents of this input field, retaining selection and carent location if supported by the browser.
 
Gets the internal native input element
 
Gets the required flag.
 
Checks the validity of the input field value; returns the error message, if any.
 
Gets the input field current value.
 
Checks the validity of the input field value.
 
setHint(hint)
Sets the hint for the input field.
 
Sets the input type.
 
setLabel(label)
Sets the ARIA label for the input field.
 
Sets the number precision.
 
setReadOnly(readonly)
Sets the read only flag.
 
setRequired(required)
Sets the required flag.
 
Sets a validation callback.
 
setValidatorFunction(obj, validator)
Sets the validator function.
 
setValidatorRegExp(regExp, errorString)
Sets the validator to be a regular expression instead of a function.
 
Sets a valid number range.
 
Sets a valid string length.
 
setValue(value, noValidate)
Sets the value for the input field.
 
setVisible(visible)
Sets the visibility flag.
 
Validates the current input in the field.
<static>  
DwtInputField.validateDate(value)
Validates a date.
<static>  
DwtInputField.validateEmail(value)
Validates an email.
<static>  
DwtInputField.validateFloat(value)
Validates a float.
<static>  
DwtInputField.validateInteger(value)
Validates an integer.
<static>  
DwtInputField.validateNumber(value)
Validates a number.
<static>  
DwtInputField.validateString(value)
Validates a string.
Methods borrowed from class DwtComposite:
addChild, cleanupSeparators, clear, dispose, getChild, getChildren, getNumChildren, getTabGroupMember, removeChild, removeChildren
Methods borrowed from class DwtControl:
addClassName, addControlListener, addDisposeListener, addListener, appendElement, blur, clearContent, clearHandler, condClassName, delClassName, focus, getBounds, getClassName, getContent, getCursor, getData, getDragBox, getDragSource, getDropTarget, getEnabled, getFocusElement, getH, getHtmlElement, getHTMLElId, getInsetBounds, getInsets, getLocation, getMargins, getOpacity, getOuterSize, getPosition, getScrollContainer, getScrollStyle, getSize, getTooltipBase, getToolTipContent, getVisibility, getVisible, getW, getX, getXW, getY, getYH, getZIndex, hasFocus, isAlertShown, isDisposed, isInitialized, isListenerRegistered, notifyListeners, preventContextMenu, preventSelection, removeAllListeners, removeControlListener, removeDisposeListener, removeListener, reparent, reparentHtmlElement, replaceElement, setBounds, setClassName, setContent, setCursor, setData, setDisplay, setDisplayState, setDragBox, setDragSource, setDropTarget, setEnabled, setEventPropagation, setFocusElement, setHandler, setHtmlElementId, setLocation, setOpacity, setPosition, setScrollStyle, setSize, setToolTipContent, setVisibility, setZIndex, showAlert, zShow
Class Detail
DwtInputField(params)
Creates an input field.
Author: Ross Dargahi.
Parameters:
{hash} params
a hash of parameters
{DwtComposite} params.parent
the parent widget
{constant} params.type
the data type of the input field
{string} params.initialValue
the initial value of the field
{number} params.size
size of the input field (in characters)
{number} params.rows
the number of rows (more than 1 means textarea)
{boolean} params.forceMultiRow
if true, forces use of textarea even if rows == 1
{number} params.maxLen
the maximum length (in characters) of the input
{constant} params.errorIconStyle
the error icon style
{constant} params.validationStyle
the validation type
{function} params.validator
the custom validation function
{Object} params.validatorCtxtObj
the object context for validation function
{string} params.className
the CSS class
{constant} params.posStyle
the positioning style (see DwtControl)
{boolean} params.required
if true, mark as required.
{string} params.hint
a hint to display in the input field when the value is empty.
{string} params.id
an explicit ID to use for the control's DIV element
{string} params.inputId
an explicit ID to use for the control's INPUT element
Field Detail
<static> DwtInputField.CONTINUAL_VALIDATION
Validate field after each character is typed.

<static> DwtInputField.DATE
Defines the "Date input field" data type.

<static> DwtInputField.ERROR_ICON_LEFT
Defines the "left" error icon style.

<static> DwtInputField.ERROR_ICON_NONE
Defines the "none" error icon style.

<static> DwtInputField.ERROR_ICON_RIGHT
Defines the "right" error icon style.

<static> DwtInputField.FLOAT
Defines the "Numeric input field" data type.

<static> DwtInputField.INTEGER
Defines the "Integer input field (no floating point numbers)" data type.

<static> DwtInputField.MANUAL_VALIDATION
Validate the field manually.

<static> DwtInputField.NUMBER
Defines the "Integer or float input field" data type.

<static> DwtInputField.ONEXIT_VALIDATION
Validate the field (i.e. after TAB or CR).

<static> DwtInputField.PASSWORD
Defines the "Password input field" data type.

<static> DwtInputField.STRING
Defines the "String input field" data type.
Method Detail
applySubstitution(regex, replacement)
Applies a regular expression to the contents of this input field, retaining selection and carent location if supported by the browser.
Parameters:
{RegExp} regex
the regular expression to search for
{String} replacement
the replacement string

{Element} getInputElement()
Gets the internal native input element
Returns:
{Element} the input element

{boolean} getRequired()
Gets the required flag.
Returns:
{boolean} true if the field is required

getValidationError()
Checks the validity of the input field value; returns the error message, if any.

{string} getValue()
Gets the input field current value.
Returns:
{string} the value

{string} isValid()
Checks the validity of the input field value.
Returns:
{string} a canonical value if valid or null if the field value is not valid

setHint(hint)
Sets the hint for the input field.
Parameters:
{string} hint
the hint

setInputType(type)
Sets the input type.
Parameters:
{constant} type
the input type

setLabel(label)
Sets the ARIA label for the input field.
Parameters:
{string} label
the label

setNumberPrecision(decimals)
Sets the number precision.
Parameters:
{number} decimals
the decimals

setReadOnly(readonly)
Sets the read only flag.
Parameters:
{boolean} readonly
if true, make field read only

setRequired(required)
Sets the required flag.
Parameters:
{boolean} required
if true, make field required

setValidationCallback(callback)
Sets a validation callback. This callback is invoked any time the input field is validated. The callback is invoked with two parameters. The first params[0] is the value of the input field. The second params[1] is a {Boolean} that if true indicates if the value is valid.
Parameters:
{AjxCallback} callback
the callback

setValidatorFunction(obj, validator)
Sets the validator function. This function is executed during validation.
Parameters:
{Object} obj
if present, the validator function is executed within the context of this object
{function} validator
the validator function

setValidatorRegExp(regExp, errorString)
Sets the validator to be a regular expression instead of a function.
Parameters:
{string} regExp
the regular expression
{string} errorString
the error string to set for tooltip if the user enters invalid data

setValidNumberRange(min, max)
Sets a valid number range. This method is only applicable for numeric input fields. It sets the valid range (inclusive) of numeric values for the field
Parameters:
{number} min
the minimum permitted value or null for no minimum
{number} max
the maximum permitted value or null for no maximum

setValidStringLengths(min, max)
Sets a valid string length.
Parameters:
{number} min
the minimum length or null for no minimum
{number} max
the maximum length or null for no maximum

setValue(value, noValidate)
Sets the value for the input field.
Parameters:
{string} value
the value
{boolean} noValidate
if true, do not validate

setVisible(visible)
Sets the visibility flag.
Parameters:
{boolean} visible
if true, the field is visible

{boolean} validate()
Validates the current input in the field. This method should be called if the validation style has been set to DwtInputField.MANUAL_VALIDATION and it is time for the field to be validated
Returns:
{boolean} true if the field is valid

<static> {boolean} DwtInputField.validateDate(value)
Validates a date.
Parameters:
{string} value
the value
Returns:
{boolean} true if valid

<static> {boolean} DwtInputField.validateEmail(value)
Validates an email.
Parameters:
{string} value
the value
Returns:
{boolean} true if valid

<static> {boolean} DwtInputField.validateFloat(value)
Validates a float.
Parameters:
{string} value
the value
Returns:
{boolean} true if valid

<static> {boolean} DwtInputField.validateInteger(value)
Validates an integer.
Parameters:
{string} value
the value
Returns:
{boolean} true if valid

<static> {boolean} DwtInputField.validateNumber(value)
Validates a number.
Parameters:
{string} value
the value
Returns:
{boolean} true if valid

<static> {boolean} DwtInputField.validateString(value)
Validates a string.
Parameters:
{string} value
the value
Returns:
{boolean} true if valid

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:28 GMT-0400 (EDT)