Methods
getValidationError() → {string}
Returns the current validation error
The validation error at this time
- Type:
- string
getValue() → {string|Array.<string>|null}
Read the current value of the input widget.
The current value of the input element. For simple inputs like text fields or selects, the return value type will be a - possibly empty - string. Complex widgets such as DynamicList instances may result in an array of strings or null for unset values.
- Type:
- string |
Array.<string> | null
isChanged() → {boolean}
Check whether the input value was altered by the user.
Returns true if the input value has been altered by the user or false if it is unchanged. Note that if the user modifies the initial value and changes it back to the original state, it is still reported as changed.
- Type:
- boolean
isValid() → {boolean}
Check whether the current input value is valid.
Returns true if the current input value is valid or false if it does not meet the validation constraints.
- Type:
- boolean
registerEvents(targetNode, synevent, events)
Dispatch a custom (synthetic) event in response to received events.
Sets up event handlers on the given target DOM node for the given event names that dispatch a custom event of the given type to the widget root DOM node.
The primary purpose of this function is to set up a series of custom uniform standard events such as widget-update, validation-success, validation-failure etc. which are triggered by various different widget specific native DOM events.
| Name | Type | Description |
|---|---|---|
targetNode | Node | Specifies the DOM node on which the native event listeners should be registered. |
synevent | string | The name of the custom event to dispatch to the widget root DOM node. |
events | Array.<string> | The native DOM events for which event handlers should be registered. |
(abstract) render() → {Node}
Render the widget, set up event listeners and return resulting markup.
Returns a DOM Node or DocumentFragment containing the rendered widget markup.
- Type:
- Node
setChangeEvents(targetNode, …events)
Set up listeners for native DOM events that may change the widget value.
Sets up event handlers on the given target DOM node for the given event names which may cause the input value to change completely, such as change events in a select menu. In contrast to update events, such change events will not trigger input value validation but they may cause field dependencies to get re-evaluated and will mark the input widget as dirty.
| Name | Type | Attributes | Description |
|---|---|---|---|
targetNode | Node | Specifies the DOM node on which the event listeners should be registered. | |
events | string | <repeatable> | The DOM events for which event handlers should be registered. |
setPlaceholder(value)
Set the current placeholder value of the input widget.
| Name | Type | Description |
|---|---|---|
value | string | | The placeholder to set for the input element. Only applicable to text inputs, not to radio buttons, selects or similar. |
setUpdateEvents(targetNode, …events)
Set up listeners for native DOM events that may update the widget value.
Sets up event handlers on the given target DOM node for the given event names which may cause the input value to update, such as keyup or onclick events. In contrast to change events, such update events will trigger input value validation.
| Name | Type | Attributes | Description |
|---|---|---|---|
targetNode | Node | Specifies the DOM node on which the event listeners should be registered. | |
events | string | <repeatable> | The DOM events for which event handlers should be registered. |
setValue(value)
Set the current value of the input widget.
| Name | Type | Description |
|---|---|---|
value | string | | The value to set the input element to. For simple inputs like text fields or selects, the value should be a - possibly empty - string. Complex widgets such as |
triggerValidation() → {boolean}
Force validation of the current input value.
Usually input validation is automatically triggered by various DOM events bound to the input widget. In some cases it is required though to manually trigger validation runs, e.g. when programmatically altering values.
- Type:
- boolean
Type Definitions
InitOptions
- Object
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
id | string | <optional> | Specifies the widget ID to use. It will be used as HTML | |
name | string | <optional> | Specifies the widget name which is set as HTML | |
optional | boolean | <optional> | true | Specifies whether the input field allows empty values. |
datatype | string | <optional> | string | An expression describing the input data validation constraints. It defaults to |
validator | function | | <optional> | Specifies one or more custom validator functions which are invoked after the standard validation constraints are checked. Each function should return | |
disabled | boolean | <optional> | false | Specifies whether the widget should be rendered in disabled state ( |