Constructor
new Forms(context, options)
- Source:
- Tutorials:
-
- Tutorial: 06-forms
Parameters:
Name | Type | Description |
---|---|---|
context |
Context | |
options |
Object | Reserved for future use |
Members
(static, readonly) FieldType :number
- Source:
Properties:
Name | Type | Description |
---|---|---|
Text |
number | Simple text (input) |
Paragraph |
number | Simple paragraph (label) |
ListBox |
number | Dropdown |
CheckBox |
number | Checkbox list |
RadioButton |
number | Radio button list |
Integer |
number | Integer input |
Double |
number | Decimal input |
DateTime |
number | Datetime input |
Percentage |
number | Percentage input |
Label |
number | Section separator - label |
HyperLink |
number | HyperLink |
Available form field types
Type:
- number
Methods
displayForm(serverUrl, formId, element, dataOptionsopt, successopt, failureopt)
- Source:
Renders a form and optionally loads the available user submitted data
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
serverUrl |
string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
formId |
Number | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
element |
string | HTMLElement | The element that hosts the form. It can be either a valid CSS selector or an HTMLElement instance. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dataOptions |
Object |
<optional> |
Supplied only when it is desired to load form submitted data as well
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
success |
function |
<optional> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
failure |
function |
<optional> |
getEnabled() → {boolean}
- Source:
Gets the state of the currently rendered form
Returns:
- Type
- boolean
getForm(serverUrl, formId, dataOptionsopt, successopt, failureopt)
- Source:
Loads a form definition and optionally the available submitted data
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
serverUrl |
String | ||||||||||||||||||||||
formId |
Number | ||||||||||||||||||||||
dataOptions |
Object |
<optional> |
Used when it is desired to load submitted data as well
Properties
|
||||||||||||||||||||
success |
Forms~getFormCallback |
<optional> |
|||||||||||||||||||||
failure |
function |
<optional> |
getForms(serverUrl, success, failureopt)
- Source:
Loads all the available form definitions from a PMA.core server
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
serverUrl |
String | The PMA.core server URL | |
success |
Forms~getFormsCallback | Called upon successful completion of the data request. | |
failure |
function |
<optional> |
hasChanges() → {boolean}
- Source:
Checks if the currently loaded form has any changes that have not been saved yet.
Returns:
- Type
- boolean
listen(eventName, callback)
- Source:
Attaches an event listener
Parameters:
Name | Type | Description |
---|---|---|
eventName |
PMA.UI.Components.Events | The name of the event to listen to |
callback |
function | The function to call when the event occurs |
renderForm(element, form, dataOptionsopt, dataopt, successopt, failureopt)
- Source:
Renders a form and optionally loads the available user submitted data without loading from the server
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
element |
string | HTMLElement | The element that hosts the form. It can be either a valid CSS selector or an HTMLElement instance. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
form |
Object | The form definition object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dataOptions |
Object |
<optional> |
Supplied only when it is desired to load form submitted data as well
Properties
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data |
Object |
<optional> |
The data to load to the form displayed | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
success |
function |
<optional> |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
failure |
function |
<optional> |
renderReadOnlyField(field, record, cssClass) → {string}
- Source:
Renders a form field in read-only form
Parameters:
Name | Type | Description |
---|---|---|
field |
Object | A PMA.core form field structure |
record |
Object | A PMA.core form field value structure |
cssClass |
string | Extra CSS class to add to the container element |
Returns:
The HTML output
- Type
- string
reset()
- Source:
Resets the currently loaded form to it's initial state
saveForm(successopt, failureopt)
- Source:
Saves the currently rendered form to PMA.core
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
success |
function |
<optional> |
|
failure |
function |
<optional> |
Fires:
setEnabled(enabled)
- Source:
Enables or disables the currently rendered form
Parameters:
Name | Type | Description |
---|---|---|
enabled |
boolean |
Type Definitions
filterDataCallback(dataopt) → {Object}
- Source:
A callback to filter the data retrieved from the server
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
Object |
<optional> |
The retrieved form data |
Returns:
The filtered data
- Type
- Object
getFormCallback(form, dataopt)
- Source:
Passes a form definition and optionally form data back to the caller
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
form |
Object | The requested form definition | |
data |
Object |
<optional> |
The submitted form data |
getFormsCallback(forms)
- Source:
Passes form definitions back to the caller
Parameters:
Name | Type | Description |
---|---|---|
forms |
Array.<Object> | Form definition objects fetched from PMA.core |
renderFieldCallback(form, field, recordopt) → {boolean}
- Source:
Called while rendering each field. This function gives the opportunity to the caller to make modifications per element, or return false to prevent rendering of specific fields.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
form |
Object | The definition of the form that is being rendered | ||||||||||
field |
Object | The definition of the field that is being rendered
Properties
|
||||||||||
record |
Object |
<optional> |
The data that will be displayed by the field. Can be null if no data is available or loaded. |
Returns:
True to render this field, otherwise false
- Type
- boolean