Class bbq.gui.form.FormField
Extends
bbq.gui.GUIWidget.
Defined in: FormField.js.
Dispatches the following notifications:
onError
Class Summary
Constructor Attributes |
Constructor Name and Description |
|
Dispatches the following notifications:
onError
|
- Fields borrowed from class bbq.lang.Delegator:
- options
Method Summary
Method Attributes |
Method Name and Description |
|
Adds the CSS class denoting that this field has focus
|
|
Adds a behaviour modifier
|
|
Adds a validator to ensure certain criteria are met.
|
|
Returns the name of this field.
|
|
Returns the current value of the field without first validating it (which could
cause an exception to be thrown).
|
|
Returns the value contained within this field.
|
|
Removes the CSS class denoting that this field has focus
|
|
|
|
Sets the value of the field
|
|
Sets the value transformer which constrains the value of the field to certain values.
|
- Methods borrowed from class bbq.gui.GUIWidget:
- addClass, appendBefore, appendChild, appendTo, blur, empty, focus, getAttribute, getID, getStyle, hide, insertAtTop, insertBefore, isClass, registerObject, removeChild, removeClass, render, replaceChild, resize, setAttribute, setID, setStyle, show
- Methods borrowed from class bbq.lang.Delegator:
- delegateMethod
- Methods borrowed from class bbq.lang.Watchable:
- deRegisterListener, notifyListener, notifyListeners, registerListener, registerOneTimeListener
Constructor Detail
bbq.gui.form.FormField(options)
Parameters:
Name |
Type |
Comment |
options |
{Object} |
|
options.value Optional |
{Object} |
An initial value |
options.onChange Optional |
{Function} |
A callback method invoked when the value of this field changes |
options.valueTransformer Optional |
{Object} |
|
options.valueTransformer.transform Optional |
{Function} |
Takes one argument and transforms it to a different value e.g. 1 to true |
options.name Optional |
{String} |
The name to be set on the input field |
Method Detail
acceptFocus()
Adds the CSS class denoting that this field has focus
addBehaviour(behaviour)
Adds a behaviour modifier
Parameters:
Name |
Type |
Comment |
behaviour |
|
|
- See:
- bbq.gui.form.behaviour.PlaceholderTextBehaviour
- bbq.gui.form.behaviour.ValidateOnBlurBehaviour
addValidator(validator)
Adds a validator to ensure certain criteria are met.
Parameters:
Name |
Type |
Comment |
validator |
|
|
- See:
- bbq.gui.form.validator.EmailValidator
- bbq.gui.form.validator.MustEqualFieldValidator
- bbq.gui.form.validator.NotNullValidatorValidator
- bbq.gui.form.validator.URLValidator
{String}
getName()
Returns the name of this field.
- Returns:
- {String}
{Object}
getUnvalidatedValue()
Returns the current value of the field without first validating it (which could
cause an exception to be thrown).
- Returns:
- {Object}
{Object}
getValue()
Returns the value contained within this field. The value will be
validated - if the value is found to be invalid an exception
will be thrown.
- Throws:
- {Error}
- The error has two fields {String} error for language translations and {bbq.gui.form.FormField} field which is the field which caused the error.
- Returns:
- {Object}
loseFocus()
Removes the CSS class denoting that this field has focus
setRootNode($super, rootNode)
Parameters:
Name |
Type |
Comment |
$super |
|
|
rootNode |
|
|
setValue(value)
Sets the value of the field
Parameters:
Name |
Type |
Comment |
value |
|
|
setValueTransformer(transformer)
Sets the value transformer which constrains the value of the field to certain values.
Parameters:
Name |
Type |
Comment |
transformer |
|
|
- See:
- bbq.gui.form.transformer.BooleanValueTransformer
- bbq.gui.form.transformer.StrinkTokeniserTransformer