OverviewSingleDeprecated

jsx3.gui

class TextBox

Object
->jsx3.lang.Object
  ->jsx3.app.Model
    ->jsx3.gui.Painted
      ->jsx3.gui.Block
        ->jsx3.gui.TextBox

All Implemented Interfaces:

jsx3.gui.Form, jsx3.gui.Interactive, jsx3.util.EventDispatcher

class TextBox
extends jsx3.gui.Block
This jsx3.gui.TextBox class allows integration of a standard HTML text input into the JSX DOM. This allows the text box to be treated like a JSX object, including positioning, serialization, updates, and data mapping/binding, etc.

Field Summary
static String
DEFAULTBACKGROUNDCOLOR
CSS color property
static String
DEFAULTCLASSNAME
jsx30textbox
static String
OVERFLOWAUTO
as needed by content
static String
OVERFLOWNORMAL
none
static String
OVERFLOWSCROLL
persistent scrollbars
static int
TYPEPASSWORD
password type 2
static int
TYPETEXT
texbox type 0
static int
TYPETEXTAREA
text area type 1
static String
VALIDATIONEMAIL
email
static String
VALIDATIONLETTER
letter
static String
VALIDATIONNONE
none
static String
VALIDATIONNUMBER
numbers only
static String
VALIDATIONPHONE
telephone
static String
VALIDATIONSSN
us ssn
static String
VALIDATIONUSZIP
uszip
static int
WRAPNO
no wrap
static int
WRAPYES
wrap text (default)
Constructor Summary
void
init(strName : String, vntLeft : int | String, vntTop : int | String, vntWidth : int | String, vntHeight : int | String, strValue : String, TYPE : String)
instance initializer
Method Summary
void
call to designate an error or alert the user's attention to the textbox on-screen.
boolean
validates form field, ensuring it contains the correct data set
String
Returns value of textbox object when it was first initialized.
int
if TYPE for the object is jsx3.gui.TextBox.TYPETEXT, and this returns a positive integer, the maxlen property for the textbox will be set to this value; returns null if no value found
int
Returns the type of TextBox.
String
Returns the custom validation expression (a regular expression pattern to match).
String
Returns the ID (CONSTANT) for one of the pre-canned regular expression filters that can be used to validate the user's response.
String
logically tries to determine the value for the text box by 1) checking for value of on-screen VIEW; 2) checking for 'value' property for in-memory MODEL 3) checking getDefaultValue() for value when object was first initialized.
static String
Deprecated.
String
Returns the text-wrapping/ word-breaking property for object if object type is jsx3.gui.TextBox.TYPETEXTAREA.
String
Returns the DHTML, used for this object's on-screen view.
jsx3.gui.TextBox
setDefaultValue(strValue : String)
set during object initialization; useful for tracking edits/updates to an object by doing a string comparison between getValue() and getDefaultValue(); returns a reference to self to facilitate method chaining
jsx3.gui.TextBox
setMaxLength(intMaxLength : int)
if TYPE for the object is jsx3.gui.TextBox.TYPETEXT, setting this to a positive integer affects the maxlen property for the textbox; returns a reference to self to facilitate method chaining
jsx3.gui.TextBox
setOverflow(OVERFLOW : String)
Sets the overflow property of this object, which defines how its on-screen view will behave when its contents are larger than its specified width and/or height.
jsx3.gui.TextBox
setType(TYPE : int)
Sets the type of jsx3.gui.TextBox returns a reference to self to facilitate method chaining
jsx3.gui.TextBox
setValidationExpression(strValidationExpression : String)
Sets the custom validation expression (a regular expression pattern to match).
jsx3.gui.TextBox
setValidationType(VALIDATIONTYPE : String)
when set, applies one of the pre-canned regular expression filters that can be used to validate the user's response; returns a reference to self to facilitate method chaining.
jsx3.gui.TextBox
setValue(strValue : String)
updates value property for both on-screen VIEW (if object is painted) and in-memory MODEL; returns a reference to self to facilitate method chaining
jsx3.gui.TextBox
setWrap(bWrap : boolean)
Sets the text-wrapping/ word-breaking property for object if object type is jsx3.gui.TextBox.TYPETEXTAREA.
Methods Inherited From jsx3.gui.Form
doKeyBinding, doReset, getDisabledBackgroundColor, getDisabledColor, getEnabled, getKeyBinding, getRequired, getValidationState, setDisabledBackgroundColor, setDisabledColor, setEnabled, setKeyBinding, setRequired, setValidationState
Methods Inherited From jsx3.gui.Block
getBackground, getBackgroundColor, getBorder, getCSSOverride, getClassName, getColor, getCursor, getDimensions, getDisplay, getFontName, getFontSize, getFontWeight, getHeight, getIndex, getLeft, getMargin, getOverflow, getPadding, getRelativePosition, getTagName, getText, getTextAlign, getTip, getTop, getVisibility, getWidth, getZIndex, hideMask, setBackground, setBackgroundColor, setBorder, setCSSOverride, setClassName, setColor, setCursor, setDimensions, setDisplay, setFontName, setFontSize, setFontWeight, setHeight, setIndex, setLeft, setMargin, setPadding, setRelativePosition, setTagName, setText, setTextAlign, setTip, setTop, setVisibility, setWidth, setZIndex, showMask
Methods Inherited From jsx3.gui.Interactive
doEvent, getCanDrag, getCanDrop, getCanMove, getCanSpy, getEvent, getEvents, getMenu, hasEvent, registerHotKey, removeEvent, removeEvents, setCanDrag, setCanDrop, setCanMove, setCanSpy, setEvent, setMenu, setSpyStyles, showSpy
Methods Inherited From jsx3.gui.Painted
focus, getAbsolutePosition, getAttribute, getAttributes, getDynamicProperty, getRendered, insertHTML, onAfterPaint, paintChild, paintChildren, recalcBox, removeAttribute, removeAttributes, repaint, setAttribute, setDynamicProperty
Methods Inherited From jsx3.app.Model
adoptChild, doClone, findAncestor, findDescendants, getAncestorOfName, getAncestorOfType, getChild, getChildIndex, getChildren, getDescendantOfName, getDescendantsOfType, getFirstChild, getFirstChildOfType, getHelpId, getId, getLastChild, getLoadType, getMetaValue, getNS, getName, getNextSibling, getParent, getPersistence, getPreviousSibling, getServer, getUriResolver, insertBefore, load, loadAndCache, loadXML, onAfterAssemble, onAfterAttach, onBeforeAssemble, onChangeServer, onDestroy, onRemoveChild, onSetChild, onSetParent, removeChild, removeChildren, setChild, setHelpId, setLoadType, setMetaValue, setName, setPersistence, toString, toXML, toXMLDoc
Methods Inherited From jsx3.util.EventDispatcher
publish, subscribe, unsubscribe, unsubscribeAll
Methods Inherited From jsx3.lang.Object
clone, equals, eval, getClass, getInstanceOf, getInstanceOfClass, getInstanceOfPackage, instanceOf, isInstanceOf, isSubclassOf, jsxmix, jsxsuper, jsxsupermix, setInstanceOf
Field Detail

DEFAULTBACKGROUNDCOLOR

static String DEFAULTBACKGROUNDCOLOR
CSS color property

DEFAULTCLASSNAME

static String DEFAULTCLASSNAME
jsx30textbox

OVERFLOWAUTO

static String OVERFLOWAUTO
as needed by content

OVERFLOWNORMAL

static String OVERFLOWNORMAL
none

OVERFLOWSCROLL

static String OVERFLOWSCROLL
persistent scrollbars

TYPEPASSWORD

static final int TYPEPASSWORD
password type 2

TYPETEXT

static final int TYPETEXT
texbox type 0

TYPETEXTAREA

static final int TYPETEXTAREA
text area type 1

VALIDATIONEMAIL

static final String VALIDATIONEMAIL
email

VALIDATIONLETTER

static final String VALIDATIONLETTER
letter

VALIDATIONNONE

static final String VALIDATIONNONE
none

VALIDATIONNUMBER

static final String VALIDATIONNUMBER
numbers only

VALIDATIONPHONE

static final String VALIDATIONPHONE
telephone

VALIDATIONSSN

static final String VALIDATIONSSN
us ssn

VALIDATIONUSZIP

static final String VALIDATIONUSZIP
uszip

WRAPNO

static final int WRAPNO
no wrap

WRAPYES

static final int WRAPYES
wrap text (default)
Constructor Detail

init

void init(strName : String, vntLeft : int | String, vntTop : int | String, vntWidth : int | String, vntHeight : int | String, strValue : String, TYPE : String)
instance initializer

Parameters:

strNameunique name distinguishing this object from all other JSX GUI objects in the JSX application
vntLefteither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
vntTopeither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
vntWidtheither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
vntHeighteither a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
strValuethis value to appear in the textbox/textarea. This value will be set as the defaultValue for the text box when it is initialized; if edits are made by the user, these edits can be accessed via [object].getValue(); if the initial value is needed, use [object].getDefaultValue();
TYPEone of two valid types: jsx3.gui.TextBox.TYPETEXT, jsx3.gui.TextBox.TYPETEXTAREA. If null is passed, jsx3.gui.TextBox.DEFAULTTYPE is used
Method Detail

beep

void beep()
call to designate an error or alert the user's attention to the textbox on-screen. Causes the textbox to 'flash/blink'

doValidate

boolean doValidate()
validates form field, ensuring it contains the correct data set

Returns:

true if field contains a valid value given @VALIDATIONTYPE  

Overrides:

doValidate in jsx3.gui.Form

getDefaultValue

String getDefaultValue()
Returns value of textbox object when it was first initialized. Default: [empty string]

Returns:

default value for object  

getMaxLength

int getMaxLength()
if TYPE for the object is jsx3.gui.TextBox.TYPETEXT, and this returns a positive integer, the maxlen property for the textbox will be set to this value; returns null if no value found

Returns:

positive integer  

getType

int getType()
Returns the type of TextBox. Default: jsx3.gui.TextBox.TYPETEXT

Returns:

one of: jsx3.gui.TextBox.TYPETEXT, jsx3.gui.TextBox.TYPETEXTAREA, jsx3.gui.TextBox.TYPEPASSWORD  

getValidationExpression

String getValidationExpression()
Returns the custom validation expression (a regular expression pattern to match). If this method returns a valid regular expression (as a string), it will be applied instead of the pre-canned regular expression. Default: null returned by the method, getValidationType; null is returned if the expression is not found

Returns:

valid regular expression such as ^\d{3}-\d{2}-\d{4}$  

getValidationType

String getValidationType()
Returns the ID (CONSTANT) for one of the pre-canned regular expression filters that can be used to validate the user's response. Default: jsx3.gui.TextBox.VALIDATIONNONE

Returns:

one of: jsx3.gui.TextBox.VALIDATIONNONE, jsx3.gui.TextBox.VALIDATIONSSN, jsx3.gui.TextBox.VALIDATIONPHONE, jsx3.gui.TextBox.VALIDATIONEMAIL, jsx3.gui.TextBox.VALIDATIONNUMBER, jsx3.gui.TextBox.VALIDATIONLETTER, jsx3.gui.TextBox.VALIDATIONUSZIP  

getValue

String getValue()
logically tries to determine the value for the text box by 1) checking for value of on-screen VIEW; 2) checking for 'value' property for in-memory MODEL 3) checking getDefaultValue() for value when object was first initialized. Default: [empty string]

Returns:

value for object  

Overrides:

getValue in jsx3.gui.Form

getVersion

static String getVersion()
Deprecated.
Returns the release/build for the class (i.e., "2.2.00")

Returns:

 

getWrap

String getWrap()
Returns the text-wrapping/ word-breaking property for object if object type is jsx3.gui.TextBox.TYPETEXTAREA. Default: jsx3.gui.TextBox.WRAPYES

Returns:

one of: jsx3.gui.TextBox.WRAPYES jsx3.gui.TextBox.WRAPNO  

paint

String paint()
Returns the DHTML, used for this object's on-screen view.

Returns:

DHTML  

Overrides:

paint in jsx3.gui.Block

setDefaultValue

jsx3.gui.TextBox setDefaultValue(strValue : String)
set during object initialization; useful for tracking edits/updates to an object by doing a string comparison between getValue() and getDefaultValue(); returns a reference to self to facilitate method chaining

Parameters:

strValuedefault value for the textbox/textarea

Returns:

this object  

setMaxLength

jsx3.gui.TextBox setMaxLength(intMaxLength : int)
if TYPE for the object is jsx3.gui.TextBox.TYPETEXT, setting this to a positive integer affects the maxlen property for the textbox; returns a reference to self to facilitate method chaining

Parameters:

intMaxLengthpositive integer, maxlen for the number of characters accepted by the textbox

Returns:

this object  

setOverflow

jsx3.gui.TextBox setOverflow(OVERFLOW : String)
Sets the overflow property of this object, which defines how its on-screen view will behave when its contents are larger than its specified width and/or height. Overflow only applies to text boxes of type TYPETEXTAREA.

Parameters:

OVERFLOWOVERFLOWNORMAL, OVERFLOWAUTO, or OVERFLOWSCROLL.

Returns:

this object. 

Overrides:

setOverflow in jsx3.gui.Block

See Also:

OVERFLOWNORMAL, OVERFLOWAUTO, OVERFLOWSCROLL

setType

jsx3.gui.TextBox setType(TYPE : int)
Sets the type of jsx3.gui.TextBox returns a reference to self to facilitate method chaining

Parameters:

TYPEone of: jsx3.gui.TextBox.TYPETEXT, jsx3.gui.TextBox.TYPETEXTAREA, jsx3.gui.TextBox.TYPEPASSWORD

Returns:

this object  

setValidationExpression

jsx3.gui.TextBox setValidationExpression(strValidationExpression : String)
Sets the custom validation expression (a regular expression pattern to match). returns a reference to self to facilitate method chaining.

Parameters:

strValidationExpressionvalid regular expression such as ^\d{3}-\d{2}-\d{4}$ If null is passed custom value is removed and [object].getValidationType() is used instead

Returns:

this object  

setValidationType

jsx3.gui.TextBox setValidationType(VALIDATIONTYPE : String)
when set, applies one of the pre-canned regular expression filters that can be used to validate the user's response; returns a reference to self to facilitate method chaining.

Parameters:

VALIDATIONTYPEone of: jsx3.gui.TextBox.VALIDATIONNONE, jsx3.gui.TextBox.VALIDATIONSSN, jsx3.gui.TextBox.VALIDATIONPHONE, jsx3.gui.TextBox.VALIDATIONEMAIL, jsx3.gui.TextBox.VALIDATIONNUMBER, jsx3.gui.TextBox.VALIDATIONLETTER, jsx3.gui.TextBox.VALIDATIONUSZIP

Returns:

this object  

setValue

jsx3.gui.TextBox setValue(strValue : String)
updates value property for both on-screen VIEW (if object is painted) and in-memory MODEL; returns a reference to self to facilitate method chaining

Parameters:

strValuevalue for the textbox/textarea

Returns:

this object  

Overrides:

setValue in jsx3.gui.Form

setWrap

jsx3.gui.TextBox setWrap(bWrap : boolean)
Sets the text-wrapping/ word-breaking property for object if object type is jsx3.gui.TextBox.TYPETEXTAREA.

Parameters:

bWrapone of: jsx3.gui.TextBox.WRAPYES jsx3.gui.TextBox.WRAPNO

Returns:

this object.  

s to determine the value for the text box by 1) checking for value of on-screen VIEW; 2) checking for 'value' property for in-memory MODEL 3) checking getDefaultValue() for value when object was first initialized. Default: [empty string]

Returns:

value for object  

Overrides:

getValue in jsx3.gui.Form

getVersion

static String getVersion()
Deprecated.
Returns the release/build for the class (i.e., "2.2.00")

Returns:

 

getWrap

Returns:
 

getWrap

String getWrap()
Returns the text-wrapping/ word-breaking property for object if object type is jsx3.gui.TextBox.TYPETEXTAREA. Default: jsx3.gui.TextBox.WRAPYES

Returns:

one of: jsx3.gui.TextBox.WRAPYES jsx3.gui.TextBox.WRAPNO  

paint

String paint()
Returns the DHTML, used for this object's on-screen view.

Returns:

DHTML  

Overrides:

paint in jsx3.gui.Block

setDefaultValue

jsx3.gui.TextBox setDefaultValue(strValue : String)
set during object initialization; useful for tracking >jsx3.gui.TextBox setDefaultValue(strValue : String)
set during object initialization; useful for tracking edits/updates to an object by doing a string comparison between getValue() and getDefaultValue(); returns a reference to self to facilitate method chaining

Parameters:

strValuedefault value for the textbox/textarea

Returns:

this object  

this object  


setMaxLength

jsx3.gui.TextBox setMaxLength(intMaxLength : int)
if TYPE for the object is jsx3.gui.TextBox.TYPETEXT, setting this to a positive integer affects the maxlen property for the textbox; returns a reference to self to facilitate method chaining

Parameters:

intMaxLengthpositive integer, maxlen for the number of characters accepted by the textbox

Returns:

this object  

setOverflow

jsx3.gui.TextBox setOverflow(OVERFLOW : String)
Sets the overflow property of this object, which defines how its on-screen view will behave when its contents are larger than its specified width and/or height. Overflow only applies to tey applies to text boxes of type TYPETEXTAREA.

Parameters:

OVERFLOWOVERFLOWNORMAL, OVERFLOWAUTO, or OVERFLOWSCROLL.

Returns:

this object. 

Overrides:

setOverflow in jsx3.gui.Block

See Also:

OVERFLOWNORMAL, OVERFLOWAUTO, OVERFLOWSCROLL

setType

jsx3.gui.TextBox setType(TYPE : int)
Sets the type of jsx3.gui.TextBox returns a reference to self to felf to facilitate method chaining

Parameters:

TYPEone of: jsx3.gui.TextBox.TYPETEXT, jsx3.gui.TextBox.TYPETEXTAREA, jsx3.gui.TextBox.TYPEPASSWORD

Returns:

this object  <

setValidationExpression

jsx3.gui.TextBox setValidationExpression(strValidationExpression : String)
Sets the custom validation expression (a regular expression pattern to match). retturns a reference to self to facilitate method chaining.

Parameters:

strValidationExpressionvalid regular expression such as ^\d{3}-\d{2}-\d{4}$ If null is passed custom value is removed and [object].getValidationType() is used instead

Returns:

this object  

setValidationType

jsx3.gui.TextBox setValidationType(VALIDATIONTYPE : String)
when set, applies one of the pre-canned regular expression filters that can be used to validate the user's response; returns a reference to self to facilitate method chaining.

Parameters:

VALIDATIONTYPEone of: jsx3.gui.TextBox.VALIDATIONNONE, jsx3.gui.TextBox.VALIDATIONSSN, jsx3.gui.TextBox.VALIDATIONPHONE, jsx3.gui.TextBox.VALIDATIONEMAIL, jsx3.gui.TextBox.VALIDATIONNUMBER, jsx3.gui.TextBox.VALIDATIONLETTER, jsx3.gui.TextBox.VALIDATIONUSZIP

Returns:

this object  

setValue

jsx3.gui.TextBox setValue(strValue : String)
updates value property for both on-screen VIEW (if object is painted) and in-memory MODEL; rreturns a reference to self to facilitate method chaining

Parameters:

strValuevalue for the textbox/textarea

Returns:

this object  

Overrides:


setWrap

jsx3.gui.TextBox setWrap(bWrap : boolean)
Sets the text-wrapping/ word-breaking property for object if object type is jsx3.gui.TextBox.TYPETEXTAREA.

Parameters:

bWrapone of: jsx3.gui.TextBox.WRAPYES jsx3.gui.TextBox.WRAPNO

Returns:

this object.