Skip to content

Form Methods

MethodInputOutputInfoHelp
clear()-voidClear the Form to empty values.help
reset()-voidReset the Form to default values.help
invalidate(msg)(string)voidMark the field as invalid. Pass an optional error message or a default error will be shown.help
resetValidation(deep)(boolean)voidReset the form validation status. Pass true for deep reset of nested fields.help
showErrors(bool)(boolean)voidShow or Hide Field Error Messages.help

Shared Methods

MethodInputOutputInfoHelp
select(path)(string)objectField Selector. Can be chained.help
update(obj)(object)voidUpdate Fields Values. Will create new fields auomatically.help
submit(obj)(object)promisePerform fields validation. After successful validation triggers onSuccess event and onError event in case of validation error.help
validate()-promiseCheck if the form is valid and return a promise.help
validate(path)(string)promiseTakes a field path in input. Check if the field and nested fields are valid and return a promise.help
validate(opt)(object)promiseTakes a an object in input with related or showErrors options.help
validate(path, opt)(string, object)promiseTakes a field path as first arg. and object as second arg. with related or showErrors options.help
check(computed)(string)booleanCheck field computed property.help
check(computed, deep)(string, boolean)booleanCheck all nested fields computed property if deep is truehelp
get()-objectGet all field and nested fields data with all props and computed values.help
get(prop)(any)objectGet all field filtering by certain props (string or array).help
set(val)(any)voidSet field value. Takes the value.help
set(obj)(object)voidProvide an object to set nested fields values.help
set(prop, val)(string, any)voidSet field property. Takes prop key and prop value.help
set(prop, obj)(string, object)voidProvide a prop key and object to set nested fields properties.help
has(key)(string)booleanProvide Field key to check if exist.help
map(callback)(function)arrayMap Nested Fieldshelp
reduce(callback, acc)(function, any)anyReduce Nested Fieldshelp
each(callback)(function)voidIterates over fields and nested fields recursively and invokes a callback which get each field in input.help
add(obj)(any)anyAdd a Field or Nested Fields.help
del(key)(any)voidDelete a Field or Nested Fields by key or path.help
move(fromIndex, toIndex)(number, number)voidMove an array field item from one index to another. Preserves bindings and validation.help
observe(obj)(object)functionDefine a MobX Observer on Field Props or Field Map. Returns a disposer function.help
intercept(obj)(object)functionDefine a MobX Interceptor on Field Props or Field Map. Returns a disposer function.help

$('path') is an alias of select(path). hasNestedFields and hasIncrementalKeys are computed properties (getters), not methods — see Form Properties.

Helpers

PropertyInputOutputInfoHelp
values()-objectGet Field & Nested Fields Values.help
errors()-objectGet Field & Nested Fields Errors.help
labels()-objectGet Field & Nested Fields Labels.help
placeholders()-objectGet Field & Nested Fields Placeholders.help
defaults()-objectGet Field & Nested Fields Default Values.help
initials()-objectGet Field & Nested Fields Initial Values.help
types()-objectGet Field & Nested Fields Type.help

Some of these Helpers methods are plurals.

Event Handlers

PropertyInputOutputInfoHelp
onSubmit(e)-objectValidate the form and call onSuccess(form) or onError(form).help
onClear(e)-objectClear all the Fields and Nested Fields to empty value.help
onReset(e)-objectReset all the Fields and Nested Fields to default value.help
onAdd(e)-objectAdd a Field or Nested Fields.help
onDel(e)-objectDelete a Field or Nested Fields.help
onDrop(e)-objectHandle file drop events when type: 'file'.help

All Event Handlers takes the Proxy object in input.

Released under the MIT License.