ebs.generateInsert
Displays a predefined form or form driven flow that allows you to add a record to a given entity.
The displayed form or form driven flow has dedicated action handler buttons that allow you to insert (and then edit) the record independently from the parent page.
Also see ebs.generateForm, ebs.generateEdit, ebs.generateList.
Syntax
Copy
function generateInsert(options: IGenerateInsertOptions): void;
| Parameter | Type | Description |
|---|---|---|
options
|
IGenerateInsertOptions | Settings for the inserted form or form driven flow. |
Type Aliases
JSON object containing settings for the insert form or form driven flow.
Copy
{
mainHtmlId: string;
entityName: string;
defaults?: string;
returnHash?: string;
formName?: string;
editFormName?: string;
}
| Property | Type | Description |
|---|---|---|
mainHtmlId
|
string | ID of the parent HTML element where the form or form driven flow will be injected. |
entityName
|
string | Name of the entity where the new record will be inserted. |
defaults (optional) |
string | Values to be populated by default in the injected form or form driven flow. |
returnHash (optional) |
string | Legacy feature. No longer used. |
formName (optional) |
string | Name of the form or form driven flow. If left empty, the default insert form or form driven flow associated with the entity is used. |
editFormName (optional) |
string | Name of the edit form or form driven flow that will be displayed after the record is saved (and goes into edit mode). If left empty, the default edit form or form driven flow associated with the source entity is used. |
Examples
In this example:
- We edit the page template of a form driven flow section to include an empty div element with the insertAccount ID and a custom button called addUser.
- In the section's After Generate tab, we include the following code that injects the default insert form of the Account entity in the div element when the button is clicked:
Copy
$('#addUser').on('click', function (event) {
ebs.generateInsert({
'mainHtmlId' : 'insertAccount',
'entityName' : 'Account',
'defaults' : null,
'returnHash' : null,
'formName' : null,
'editFormName' : null});
});