Form

The Form Class provides properties, methods, and events to interface with the Table or DataProvider data. This is generated by the <silk:Form> tag.

Kind: global class

Properties

Name
Type
Description

$form

Object

jQuery object referencing to the form HTML tag.

mask

Boolean

Indicates if the form's mas is active.

insertBt

Object

The Button object to initiate an insert if provided.

updateBt

Object

The Button object to initiate an update if provided.

deleteBt

Object

The Button object to initiate a delete if provided.

insertBtVisible

function

Function defining if the insert button shoudl be visible. The function should return true or false.

updateBtVisible

function

Function defining if the update button shoudl be visible. The function should return true or false.

deleteBtVisible

function

Function defining if the delete button shoudl be visible. The function should return true or false.

submitBtValidation

function

Function to to decide if the submit button should be active. This should return a boolean.

Methods and Event

new Form(id, options)

Returns a DataProvider instance.

Param
Type
Default
Description

id

String

Unique identifier.

options

Object

Object containing the DataProvider configuration options.

[options.startMode]

Boolean

false

Starting mode: true editing, false read.

[options.dialog]

Boolean

true

If dialog is false it activates the inputs mode and cancel the process to avoid showing the dialog bar.

[opsions.dataSource]

String

The ID of the Table or dataProvider.

[options.insertBt]

String

The ID of the button use to activate an insert action.

[options.updateBt]

String

The ID of the button use to activate an update action.

[options.deleteBt]

String

The ID of the button use to activate an delete action.

[options.cancelBt]

String

The ID of the button use to activate an cancel action.

[options.submitBt]

String

The ID of the button use to activate an submit action.

[options.dialogTitle]

String

The title of the dialog box.

[options.insertTitle]

String

The title for the insert action.

[options.updateTitle]

String

The title for the update action.

[options.deleteTitle]

String

The title for the delete action.

[options.insertMessage]

String

The message for the insert action.

[options.updateMessage]

String

The message for the update action.

[options.deleteMessage]

String

The message for the delete action.

clean()

Cleans the inputs values

Kind: instance method of Form

dispatchOnChange(Input)

Method used by Inputs to trigger the parent Form's change event.

Kind: instance method of Form

Param
Type
Description

Input

Input

= The Input object triggering the change event.

doCancel()

Operates a cancel operation.

Kind: instance method of Form

fillInputValues()

Fills the input with data from dataSource.

Kind: instance method of Form

getAction()

Gets the set form's action.

Kind: instance method of Form

getEventList() ⇒ Array

Returns the list of event loaded.

Kind: instance method of Form

getInputs() ⇒ Array

Gets input array.

Kind: instance method of Form

getMode() ⇒ Boolean

Gets the Form's mode.

Kind: instance method of Form

getOperationList(action) ⇒ Object

Generates the operationList Object which the DataProvider will use to submit data to the server.

Kind: instance method of Form

Param
Type
Description

action

Boolean

The action to process

getPage() ⇒ String

Gets the page's ID hosting the Form

Kind: instance method of Form

getSelectedItem() ⇒ Object

Gets the select item in the Table or DataProvider.

Kind: instance method of Form

hide()

Hides the button

Kind: instance method of Form

load()

Loads the data from the data source into the Form's inputs.

Kind: instance method of Form

on

Extends the "on" method from the eventManager Class.

Kind: instance property of Form

Param
Type
Description

eventName

String

The event's name.

eventFunction

function

The function to be triggered.

pushInput(input)

Adds an input object to the input array.

Kind: instance method of Form

Param
Type
Description

input

Input

The Input object to add.

setAction(action)

Sets the action form's action.

Kind: instance method of Form

Param
Type
Description

action

String

This coudl be "insert", "update", "delete".

setDelete()

Sets the Form a delete operation

Kind: instance method of Form

setDialogTitle(title)

Sets the dialog title

Kind: instance method of Form

Param
Type
Description

title

String

The title text

setInputMode(mode, [setPreviousData])

Scans the Form's inputs and change their mode.

Kind: instance method of Form

Param
Type
Default
Description

mode

Boolean

Defines if field will be for input or read only

[setPreviousData]

Boolean

true

If true it will re-apply the previousData value. If not included the default value is true.

setInsert()

Sets the Form an insert operation

Kind: instance method of Form

setMode([viewMode])

Set the Form mode. True defines data entry mode. False defines read only mode. If parameter is not provided it sets read only.

Kind: instance method of Form

Param
Type
Default
Description

[viewMode]

Boolean

false

The mode to set.

setUpdate()

Sets the Form an update operation

Kind: instance method of Form

show()

Shows the button

Kind: instance method of Form

toggle(status)

Hides or shows the form based on the provided parameter.

Kind: instance method of Form

Param
Type
Description

status

boolean

True shows and false hides.

on:afterLoad (action)

Event triggered after the Form load the data from dataSource. Created with the Form.on("afterLoad", function(){}) method.

Kind: event emitted by Form

Param
Type
Description

action

String

The executed action.

on:afterModeChange

Event triggered before the mode (editing, reading) changes. Created with the Form.on("afterModeChange", function(){}) method.

Kind: event emitted by Form

on:beforeLoad (action)

Event triggered before the Form load the data from dataSource. Created with the Form.on("beforeLoad", function(){}) method.

Kind: event emitted by Form

Param
Type
Description

action

String

The executed action.

on:beforeModeChange

Event triggered before the mode (editing, reading) changes. Created with the Form.on("beforeModeChange", function(){}) method.

Kind: event emitted by Form

on:beforeSubmit

Event triggered before data is submited. If it return false the process is canceled. Created with the Form.on("beforeSubmit", function(){}) method.

Kind: event emitted by Form

on:cancel

Event triggered before the Form is set for a cancel. If function return false the process is canceled. Created with the Form.on("cancel", function(){}) method.

Kind: event emitted by Form

on:change

Event triggered inputs values change. Created with the Form.on("change", function(){}) method.

Kind: event emitted by Form

on:delete

Event triggered before the Form is set for a delete. If function return false the process is canceled. Created with the Form.on("delete", function(){}) method.

Kind: event emitted by Form

on:error

Event triggered after an error loading the data. Created with the Form.on("error", function(){}) method.

Kind: event emitted by Form

on:FormErrors (inputList)

Event triggered when Form's inputs have errors. Created with the Form.on("formErrors", function(){}) method.

Kind: event emitted by Form

Param
Type
Description

inputList

Array

The list of iputs with errors.

on:insert

Event triggered before the Form is set for an insert. If function return false the process is canceled. Created with the Form.on("insert", function(){}) method.

Kind: event emitted by Form

on:submit

Event triggered before the Form is set for a submit. If function return false the process is canceled. Created with the Form.on("submit", function(){}) method.

Kind: event emitted by Form

on:update

Event triggered before the Form is set for an update. If function return false the process is canceled. Created with the Form.on("update", function(){}) method.

Kind: event emitted by Form