createRecord ( opts: Object ) →{ Record }
Creates a record using the form's data.
Parameters
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts | Object | Configuration object. Properties
|
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
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
|
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
|
Returns
True if the form's data was valid, otherwise false.