Interface: Form

Form

Methods

createRecord(opts)

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.

getModel() → {Model}

Returns the model used by the form.
Returns:
- The form's model
Type
Model

getRecordId() → {ID}

Gets the ID of the Record held by this form
Returns:
ID of the Record in the form "api":"Form", "returntype":"ID" }
Type
ID

load(id, callback)

Loads the record with the specified id into the form.
Parameters:
Name Type Description
id ID | String The ID of the record to load.
callback function Callback when the load is completed.

setData(item)

Sets the form's data to the specified record.
Parameters:
Name Type Description
item Record | Object The record to use as the form's data.

submit(options) → {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.
onSuccess function Callback when the form was submitted successfully.
Returns:
- A boolean indicating whether the form was actually submitted to the server or not.
Type
Boolean

validate(options) → {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.
Type
Boolean