Class: module:argos/Fields/NoteField

module:argos/Fields/NoteField()

The NoteField is a special case where an overly long text string should be inserted and you want to take the user to another view for that specific input.

The special part is that the it passes the value between its editor via an object with a "Note" property., meaning the Edit View layout should have a field bound to the noteProperty defined in this field ("Notes" by default").

Constructor

new module:argos/Fields/NoteField()

Extends:
Source:
Example
{
  name: 'FullDescription',
  property: 'FullDescription',
  label: this.fullDescriptionText,
  type: 'note',
  view: 'text_editor_edit'
}

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 property property.

Inherited From:
Source:

attributeMap

Properties:
Name Type Description
Creates Object

a setter map to html nodes, namely:

  • inputValue => inputNode's value attribute
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:

clearNode

Properties:
Name Type Description
The HTMLElement

dojo-attach-point reference to the clear button

Inherited From:
Source:

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:

enableClearButton

Properties:
Name Type Description
Overrides Boolean

default to hide the clear button.

Inherited From:
Source:

hidden

Properties:
Name Type Description
hidden Boolean

Indicates the visibility state

Inherited From:
Source:

inputNode

Properties:
Name Type Description
The HTMLElement

dojo-attach-point reference to the input element

Inherited From:
Source:

inputType

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:

notificationTrigger

Inherited From:
Source:

originalValue

Properties:
Name Type Description
Value String

storage for keeping track of modified/unmodified values. Used in isDirty.

Inherited From:
Source:

owner

Properties:
Name Type Description
owner View

View that controls the field.

Inherited From:
Source:

previousValue

Properties:
Name Type Description
Value String

storage for detecting changes either via direct input or programmatic setting.

Inherited From:
Source:

property

Properties:
Name Type Description
property String

The SData property that the field will be bound to.

Inherited From:
Source:

required :Boolean

required should be true if the field requires input. Defaults to false.

Type:
  • Boolean
Inherited From:
Source:

rows

Inherited From:
Source:

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:

validationTrigger

Inherited From:
Source:

validInputOnly

Inherited From:
Source:

widgetTemplate

Properties:
Name Type Description
Simplate Simplate

that defines the fields HTML Markup

  • $ => Field instance
  • $$ => Owner View instance
Inherited From:
Source:

Methods

_onBlur(evt)

Handler for the onblur event

If either the validationTrigger or notificationTrigger is set to blur then it will fire the respective function.

Parameters:
Name Type Description
evt Event
Inherited From:
Source:

_onKeyPress(evt)

Handler for the onkeypress event which is not connected unless validInputOnly is true.

Since this is a direct tie-in for validInputOnly, this intercepts the key press, adds it to the current value temporarily and validates the result -- if it validates the key press is accepted, if validation fails the key press is rejected and the key is not entered.

Parameters:
Name Type Description
evt Event
Inherited From:
Source:

_onKeyUp(evt)

Handler for the onkeyup event.

If either the validationTrigger or notificationTrigger is set to keyup then it will fire the respective function.

Parameters:
Name Type Description
evt Event
Inherited From:
Source:

buildRendering()

Processes this.widgetTemplate or this.contentTemplate

Inherited From:
Source:

clearValue(asDirty)

Clears the input nodes value, optionally clearing as a modified value.

Parameters:
Name Type Description
asDirty Boolean

If true it signifies the clearing is meant as destroying an existing value and should then be detected as modified/dirty.

Inherited From:
Source:

disable()

Extends the parent implementation to set the disabled attribute of the input to true

Inherited From:
Source:

enable()

Extends the parent implementation to set the disabled attribute of the input to false

Inherited From:
Source:

focus()

Focuses the input for the field

Inherited From:
Source:

getValue() → {String}

Returns the input nodes value

Inherited From:
Source:
Returns:
Type
String

hide()

Sets hidden to true and fires onHide.

Inherited From:
Source:

init()

Extends the parent implementation to optionally bind the onkeypress event if validInputOnly is true. Binds the 'onblur' and 'keyup' events.

Inherited From:
Source:

isDirty() → {Boolean}

Determines if the value has been modified from the default/original state

Inherited From:
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:

onNotificationTrigger(evt)

Fires onChange if the value has changed since the previous notification event or a direct setting of the value.

Parameters:
Name Type Description
evt Event
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:

onValidationTrigger(evt)

Immediately calls validate and adds the respective row styling.

Parameters:
Name Type Description
evt Event
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 value of the input node, clears the previous value for notification trigger and if setting an initial value - set the originalValue to the passed value for dirty detection.

Parameters:
Name Type Description
val String

Value to be set

initial Boolean

True if the value is the default/clean value, false if it is a meant as a dirty value

Inherited From:
Source:

setValueNoTrigger(val, initial)

Sets the value of the input node, and set the value as the previous value so notification trigger will not trigger and if setting an initial value - set the originalValue to the passed value for dirty detection.

Parameters:
Name Type Description
val String

Value to be set

initial Boolean

True if the value is the default/clean value, false if it is a meant as a dirty value

Inherited From:
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 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.
  • 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