ludo.form.Text

ludo.form.


new ludo.form.Text(config)

Form input text

Parameters:
Name Type Description
config Object

Configuration when creating the View. These properties and properties from superclass is available

Properties
Name Type Description
name String

Name of element. A call to parentView.getForm().values() will return <name> : <value>.

placeholder String

Placeholder attribute for the input. Displayed when value is empty. (Default:undefined)

minLength Number

Defines required min length of value(count characters). (Default:undefined)

maxLength Number

Defines required max length of value(count characters)

ucFirst Boolean

True to automatically Uppercase first letter. (Default: false)

regex RegExp

Regular expression used for validation, example: regex: /$[0-9]{3}^/ to require 3 digits. (Default:undefined)

readonly Boolean

True to make this form field read only. (Default: false)

selectOnFocus Boolean

Automatically make the text selected on focus. Default: false

validateKeyStrokes Boolean

True to run validation after every key stroke(Default: false)

autoComplete Boolean

False to disable browsers auto complete(default : true)

validator function

Optional validator function for the value.

Source:
Fires:
  • ludo.form.Text#key Fired when a key is pressed.event: Argument: {String} key pressed.

Extends

Methods


clear()

Reset value back to the original value sent(constructor value)

Inherited From:
Source:

commit()

Update initial value to current value. These actions will always trigger a commit

  • Form or Model submission
  • Fetching new record for a ludo.model.Model
Inherited From:
Source:

disable()

Disable form element

Inherited From:
Source:
Returns:

void


enable()

Enable form element

Inherited From:
Source:
Returns:

void


focus()

Focus form element

Source:
Returns:

void


getFormEl()

Get reference to input element

Inherited From:
Source:
Returns:

DOMElement


isDirty() → {Boolean}

Returns true if current value is different from original value

Inherited From:
Source:
Returns:

isDirty

Type
Boolean

isValid() → {Boolean}

Returns true when value of form element is valid, i.e. larger than minValue, matching regex etc.

Inherited From:
Source:
Returns:

valid

Type
Boolean

reset()

Reset / Roll back to last committed value. It could be the value stored by last commit method call
or if the original value/default value of this field.

Inherited From:
Source:
Returns:

void


rollback()

Alias to reset

Inherited From:
Source:

setEnabled(enabled)

Enable or disable form element

Parameters:
Name Type Description
enabled Boolean
Inherited From:
Source:

val(val) → {*}

Set or get value. If val argument is set, you will set a value, if not current value
will be returned.

Parameters:
Name Type Description
val String | Number | Array | Object | Boolean
Inherited From:
Source:
Returns:
Type
*