Skip to content

Helpers

The helpers can be used on the form instance or every field and nested field.


Field Selector

javascript
.$('myFieldName');

Shortcut of select()


Access Form Instance From Fields

Every Field instance can access the Form instance using the state prop:

javascript
field.state.form // access Form instance

Get all Fields Values

Returns an object with all fields key:val pairs.

javascript
.values();
=> {
  username: 'TheUsername',
  password: 'ThePassword',
}

Shortcut of get('value')

Get all Fields Errors

Returns an object with all fields key:val pairs.

javascript
.errors();
=> {
  username: 'The Username Error',
  password: 'The Password Error',
}

Shortcut of get('error')

Get all Fields Labels

Returns an object with all fields key:val pairs.

javascript
.labels();

Shortcut of get('label')

Get all Fields Placeholders

Returns an object with all fields key:val pairs.

javascript
.placeholders();

Shortcut of get('placeholder')

Get all Fields Defaults Values

Returns an object with all fields key:val pairs.

javascript
.defaults();

Shortcut of get('default')

Get all Fields Initials Values

Returns an object with all fields key:val pairs.

javascript
.initials();

Shortcut of get('initial')

Get all Fields Types

Returns an object with all fields key:val pairs.

javascript
.types();

Shortcut of get('type')

Released under the MIT License.