Form Methods
| Method | Input | Output | Info | Help |
|---|---|---|---|---|
| clear() | - | void | Clear the Form to empty values. | help |
| reset() | - | void | Reset the Form to default values. | help |
| invalidate(msg) | (string) | void | Mark the field as invalid. Pass an optional error message or a default error will be shown. | help |
| resetValidation(deep) | (boolean) | void | Reset the form validation status. Pass true for deep reset of nested fields. | help |
| showErrors(bool) | (boolean) | void | Show or Hide Field Error Messages. | help |
Shared Methods
| Method | Input | Output | Info | Help |
|---|---|---|---|---|
| select(path) | (string) | object | Field Selector. Can be chained. | help |
| update(obj) | (object) | void | Update Fields Values. Will create new fields auomatically. | help |
| submit(obj) | (object) | promise | Perform fields validation. After successful validation triggers onSuccess event and onError event in case of validation error. | help |
| validate() | - | promise | Check if the form is valid and return a promise. | help |
| validate(path) | (string) | promise | Takes a field path in input. Check if the field and nested fields are valid and return a promise. | help |
| validate(opt) | (object) | promise | Takes a an object in input with related or showErrors options. | help |
| validate(path, opt) | (string, object) | promise | Takes a field path as first arg. and object as second arg. with related or showErrors options. | help |
| check(computed) | (string) | boolean | Check field computed property. | help |
| check(computed, deep) | (string, boolean) | boolean | Check all nested fields computed property if deep is true | help |
| get() | - | object | Get all field and nested fields data with all props and computed values. | help |
| get(prop) | (any) | object | Get all field filtering by certain props (string or array). | help |
| set(val) | (any) | void | Set field value. Takes the value. | help |
| set(obj) | (object) | void | Provide an object to set nested fields values. | help |
| set(prop, val) | (string, any) | void | Set field property. Takes prop key and prop value. | help |
| set(prop, obj) | (string, object) | void | Provide a prop key and object to set nested fields properties. | help |
| has(key) | (string) | boolean | Provide Field key to check if exist. | help |
| map(callback) | (function) | array | Map Nested Fields | help |
| reduce(callback, acc) | (function, any) | any | Reduce Nested Fields | help |
| each(callback) | (function) | void | Iterates over fields and nested fields recursively and invokes a callback which get each field in input. | help |
| add(obj) | (any) | any | Add a Field or Nested Fields. | help |
| del(key) | (any) | void | Delete a Field or Nested Fields by key or path. | help |
| move(fromIndex, toIndex) | (number, number) | void | Move an array field item from one index to another. Preserves bindings and validation. | help |
| observe(obj) | (object) | function | Define a MobX Observer on Field Props or Field Map. Returns a disposer function. | help |
| intercept(obj) | (object) | function | Define a MobX Interceptor on Field Props or Field Map. Returns a disposer function. | help |
$('path')is an alias ofselect(path).hasNestedFieldsandhasIncrementalKeysare computed properties (getters), not methods — see Form Properties.
Helpers
| Property | Input | Output | Info | Help |
|---|---|---|---|---|
| values() | - | object | Get Field & Nested Fields Values. | help |
| errors() | - | object | Get Field & Nested Fields Errors. | help |
| labels() | - | object | Get Field & Nested Fields Labels. | help |
| placeholders() | - | object | Get Field & Nested Fields Placeholders. | help |
| defaults() | - | object | Get Field & Nested Fields Default Values. | help |
| initials() | - | object | Get Field & Nested Fields Initial Values. | help |
| types() | - | object | Get Field & Nested Fields Type. | help |
Some of these Helpers methods are plurals.
Event Handlers
| Property | Input | Output | Info | Help |
|---|---|---|---|---|
| onSubmit(e) | - | object | Validate the form and call onSuccess(form) or onError(form). | help |
| onClear(e) | - | object | Clear all the Fields and Nested Fields to empty value. | help |
| onReset(e) | - | object | Reset all the Fields and Nested Fields to default value. | help |
| onAdd(e) | - | object | Add a Field or Nested Fields. | help |
| onDel(e) | - | object | Delete a Field or Nested Fields. | help |
| onDrop(e) | - | object | Handle file drop events when type: 'file'. | help |
All Event Handlers takes the Proxy object in input.