Form Element

All the form elements like inputs, selects and textareas have some additional features in RightJS to help you work with them.

Events

Unlike other DOM elements, form elements handle a bunch of additional events:

  • disable
  • enable
  • focus
  • blur
  • change

They are handled simultaneously with all the other events. All shortcuts are in place, you can wire and run the events the usual way.

Methods

include, blur, disable, enable, focus, getValue, select, setValue

top ↑include

include(Object methods[, boolean dont_rewrite])

Description

Registers additional methods for the form input element units, like INPUT, SELECT, TEXTAREA.

Example

Form.Element.include({
myMethod: function() {....}
});

$('my_input').myMethod();

top ↑blur

blur() -> Element self

Description

Looses the focus on the element.

Example

$('input').blur();

top ↑disable

disable() -> Element self

Description

Disables the element.

Example

$('element').disable();

top ↑enable

enable() -> Element self

Description

Enables the element.

Example

$('input').enable();

top ↑focus

focus() -> Element self

Description

Puts the focus on the element.

Example

$('input').focus();

top ↑getValue

getValue() -> mixed value

Description

Unified access to get a form element value.

Example

$('input').getValue();
$('select').getValue();
$('textarea').getValue();
$('multi-select').getValue();

top ↑select

select() -> Element self

Description

Puts the focus on the element and selects its data.

Example

$('input').select();

top ↑setValue

setValue(mixed value) -> Element self

Description

Unified value setter for the form elements.

Example

$('input').setValue('text');
$('select').setValue(1);
$('textarea').setValue('text');
$('multi-select').setValue([1,2,3]);