createRecord ( opts: Object ) { Record }

Creates a record using the form's data.

Parameters
Name Type Description
opts Object

Configuration object.

Properties
Name Type Description
submit Boolean
keepIds Boolean
full Boolean If true, any child forms' data are used to create related records.
nodelete Boolean opts.nodelete

disable ( )

Disable this form. This disables all widgets connected to this form.

enable ( )

Enable this form. This enables all widgets connected to this form.

getChildren ( ) { Array | *[] }

Gets the child forms of this form (if any)

getId ( ) { String }

Gets the ID of this form

Returns

ID of this form

getModel ( ) { Model }

Returns the model used by the form.

Returns

The form's model

getParent ( ) { Form }

Gets the parent of this form

getRecordId ( ) { ID }

Gets the ID of the Record held by this form

Returns

ID of the Record in the form

getValue ( name: String , original: Boolean )

Get a value from this form

Parameters
Name Type Description
name String

Name of field to get

original Boolean

If true it will get the original value of this field

hasChanged ( name: String )

Check if a value has changed in this form since it was loaded

Parameters
Name Type Description
name String

Name of field to check

hasPrivilege ( privilege: String ) { Boolean }

Checks whether the user has a certain privilege on the record held by this form (note: for this to be 100% accurate the form must be configured to laod privileges, otherwise only blanket privileges are considered)

Parameters
Name Type Description
privilege String

Name of privilege to check for

Returns

true if the user has the requested privilege

isChild ( ) { Boolean }

Check whether this is a child-form

Returns

form

isCreate ( ) { Boolean }

Check whether this form is holding a new record or not

Returns

true if the form represents a new record

isEdit ( ) { Boolean }

Check whether this form is holding an existing record or not

Returns

true if the form represents an existing record

isEnabled ( ) { Boolean }

Check if this form is enabled or not

Returns

true if this form is enabled

isTemporary ( ) { Boolean }

Check whether this is a temporary form (i.e. a dynamically created one)

Returns

true if the form is temporary

isTransactional ( ) { Boolean }

Check whether this form is in transactional mode

Returns

true if the form is in transactional mode

load ( id: ID, callback: Function )

Loads the record with the specified id into the form.

Parameters
Name Type Description
id ID

The ID of the record to load.

callback Function

Callback when the load is completed.

loadRelation ( name: String , add: Boolean , labels: Boolean ) { Promise<Array> }

Loads (or reloads) a relation of the record held by this form.

Parameters
Name Type Description
name String

Name of relation to load

add Boolean

Pass true to update the contents of the form

labels Boolean

Pass true to load labels of the related records

reset ( focused: Boolean )

Reset this form back to its default values

Parameters
Name Type Description
focused Boolean

If set to true the form will focus the first input-field

setData ( item: Record )

Sets the form's data to the specified record.

Parameters
Name Type Description
item Record

The record to use as the form's data.

setOriginalValue ( name: String , value: String )

Change the original (loaded) value of a field in this form

Parameters
Name Type Description
name String

Name of field to set

value String

Value to set

setTransactional ( transactional: Boolean )

Enables/disables transactional mode

Parameters
Name Type Description
transactional Boolean

transactional

setValue ( name: String , value: String )

Set a value on this form

Parameters
Name Type Description
name String

Name of field to set

value String

Value to set

submit ( options: Object ) { Boolean }

Submits the form.

Parameters
Name Type Description
options Object

Configuration object.

Properties
Name Type Description
successMessage String Message to display on success.
errorMessage String Message to display on error.
full Boolean If included, the submission will also include child forms.
preventReset Boolean Instead of resetting, the form will be loaded with the new data after submission.
suppressNotifications Boolean Set to true to suppress any notifications displayed as a result of this submission.
override Object Object with attribute-values to override the form contents with upon submission
exclude Array List of attributes to exclude from the submission
onSuccess Function Callback when the form was submitted successfully.
Returns

A boolean indicating whether the form was actually submitted to the server or not.

validate ( options: Object ) { Boolean }

Validates the form's data.

Parameters
Name Type Description
options Object

Configuration object.

Properties
Name Type Description
alert Boolean If included an alert will be displayed if errors are found
Returns

True if the form's data was valid, otherwise false.