Constructor
new module:argos/Fields/BooleanField()
Extends:
Example
{
name: 'IsLead',
property: 'IsLead',
label: this.isLeadText,
type: 'boolean'
}
Extends
Members
alwaysUseValue
Properties:
Name | Type | Description |
---|---|---|
alwaysUseValue |
Boolean | Signifies that the field should always be included when the form calls getValues. |
- Inherited From:
- Source:
applyTo
Properties:
Name | Type | Description |
---|---|---|
applyTo |
String | If defined it will use the applyTo string when getting and setting properties from
the SData object instead of the |
- Inherited From:
- Source:
autoFocus
Properties:
Name | Type | Description |
---|---|---|
autoFocus |
Boolean | Flag to indicate if this field should be focused when the form is shown. |
- Inherited From:
- Source:
checked
Properties:
Name | Type | Description |
---|---|---|
When |
Boolean | clearing the boolean field it sets the fields value to |
containerNode
Properties:
Name | Type | Description |
---|---|---|
The |
HTMLElement | parent container element of the field. |
- Inherited From:
- Source:
default
This applies a default value when inserting a new record, the default value is applied after the template entry but before the context and changes are applied.
Note the word default
must be in quotes as default is a reserved word in javascript.
- Inherited From:
- Source:
disabled
Properties:
Name | Type | Description |
---|---|---|
disabled |
Boolean | Indicates the disabled state |
- Inherited From:
- Source:
hidden
Properties:
Name | Type | Description |
---|---|---|
hidden |
Boolean | Indicates the visibility state |
- Inherited From:
- Source:
label
Properties:
Name | Type | Description |
---|---|---|
label |
String | The text that will, by default, show to the left of a field. |
- Inherited From:
- Source:
name
Properties:
Name | Type | Description |
---|---|---|
name |
String | The unique (within the current form) name of the field |
- Inherited From:
- Source:
originalValue
Value used during dirty/modified comparison
owner
Properties:
Name | Type | Description |
---|---|---|
owner |
View | View that controls the field. |
- Inherited From:
- Source:
property
Properties:
Name | Type | Description |
---|---|---|
property |
String | The SData property that the field will be bound to. |
- Inherited From:
- Source:
toggleNode
Properties:
Name | Type | Description |
---|---|---|
The |
HTMLElement | div node that holds the toggled attribute |
toggleValue
Properties:
Name | Type | Description |
---|---|---|
Local |
Boolean | value used to reset toggle node if the field is disabled |
type
Properties:
Name | Type | Description |
---|---|---|
type |
String | The registered name of the field that gets mapped in FieldManager when the field is constructed |
- Inherited From:
- Source:
widgetTemplate
Properties:
Name | Type | Description |
---|---|---|
Simplate |
Simplate | that defines the fields HTML Markup
|
- Overrides:
- Source:
Methods
_onClick(evt)
Fires with the toggle switch is pressed and sets the value to the opposite of the current value
Parameters:
Name | Type | Description |
---|---|---|
evt |
Event | The click/tap event |
buildRendering()
Processes this.widgetTemplate
or this.contentTemplate
- Inherited From:
- Source:
clearValue(flag)
Sets the value back to this.checked
as the initial value. If true is passed it sets
this.checked
as a dirty/modified value.
Parameters:
Name | Type | Description |
---|---|---|
flag |
Boolean | Signifies if the cleared value should be set as modified (true) or initial (false/undefined) |
- Overrides:
- Source:
disable()
Sets disabled to true and fires onDisable.
- Inherited From:
- Source:
enable()
Sets disabled to false and fires onEnable.
- Inherited From:
- Source:
focus()
Focuses the input for the field
- Inherited From:
- Source:
getValue() → {Boolean}
Returns the current toggled state
- Overrides:
- Source:
Returns:
- Type
- Boolean
hide()
Sets hidden to true and fires onHide.
- Inherited From:
- Source:
init()
Calledd during app startup after all fields have been inserted into the view
- Inherited From:
- Source:
isDirty() → {Boolean}
Determines if the field has been modified from it's original value
- Overrides:
- Source:
Returns:
- Type
- Boolean
isDisabled() → {Boolean}
Returns the disabled state
- Inherited From:
- Source:
Returns:
- Type
- Boolean
isHidden() → {Boolean}
Returns the hidden state
- Inherited From:
- Source:
Returns:
- Type
- Boolean
onChange(field)
Event that fires when the field is changed
Parameters:
Name | Type | Description |
---|---|---|
field |
_Field | The field itself |
- Inherited From:
- Source:
onDisable(field)
Event that fires when the field is disabled
Parameters:
Name | Type | Description |
---|---|---|
field |
_Field | The field itself |
- Inherited From:
- Source:
onEnable(field)
Event that fires when the field is enabled
Parameters:
Name | Type | Description |
---|---|---|
field |
_Field | The field itself |
- Inherited From:
- Source:
onHide(field)
Event that fires when the field is hidden
Parameters:
Name | Type | Description |
---|---|---|
field |
_Field | The field itself |
- Inherited From:
- Source:
onShow(field)
Event that fires when the field is shown
Parameters:
Name | Type | Description |
---|---|---|
field |
_Field | The field itself |
- Inherited From:
- Source:
renderTo(node)
Inserts the field into the given DOM node using dijit Widget placeAt(node)
and saves
a reference to it to this.containerNode
.
Parameters:
Name | Type | Description |
---|---|---|
node |
HTMLElement | Target node to insert the field into |
- Inherited From:
- Source:
setValue(val, initial)
Sets the toggled attribute of the field and applies the needed styling.
It also directly fires the onChange event.
Parameters:
Name | Type | Description |
---|---|---|
val |
Boolean/String/Number | If string is passed it will use |
initial |
Boolean | If true sets the value as the original value and is later used for dirty/modified detection. |
- Overrides:
- Source:
show()
Sets hidden to false and fires onShow.
- Inherited From:
- Source:
validate(value) → {Boolean/Object}
The validate function determines if there is any errors - meaning it will return false for a "Error free" field.
###Basic Flow:
-
loops over each
validator
defined on the field -
Evaluate the result
- If the validator is a RegExp, use return
!regExp.test(value)
- If the validator is a function, call and return the result of the function passing the value, _Field instance, and the
owner
property. - If the validator is an object and has a
test
key, follow the RegExp path. - If the validator is an object and has a
fn
key, follow the function path.
- If the validator is a RegExp, use return
-
If the result is true and the validator is an object with a
message
key:- If message is a function, call and return the result of the function passing the value, _Field instance and the
owner
property. - Otherwise, assume it is a string format and call dojo's
string.substitute
using the message as the format,${0}
as the value,${1}
as the fields name,${2}
as the fields label property. - Save the result of the function or string substitution as the result itself.
- If message is a function, call and return the result of the function passing the value, _Field instance and the
-
Return the result.
Parameters:
Name | Type | Description |
---|---|---|
value |
Value of the field, if not passed then getValue is used. |
- Inherited From:
- Source:
Returns:
False signifies that everything is okay and the field is valid, true
or a string message
indicates that it failed.
- Type
- Boolean/Object