eForm Events

The table in this topic give the list of eForm events you can use in JavaScript.

Examples

  • (Example) Use Custom JavaScript in an eForm
  • JavaScript Methods for eForm Builder - Examples for JavaScript methods that are available out-of-the-box (OOTB) in AgilePoint NX.
  • REST API - Code examples for implementing the REST API.
  • Advanced Examples

    For more advanced or complex examples or specific information about how to solve a specific business problem or use case, AgilePoint recommends the following resources:

    • AgilePoint Community Forums - A free, AgilePoint-moderated, crowd-sourcing user forum where you can ask questions about specific techniques, the solutions to use cases, workarounds, or other topics that may not be covered in the Product Documentation.
    • Video Portal - Video walkthroughs for a range of simple and advanced tasks in AgilePoint NX.
    • Professional Services - If you can not find the information you need for your specific business problem, mentoring is available through AgilePoint Professional Services.
    • Personalized Training - AgilePoint can provide personalized training for your organization. To request personalized training, contact AgilePoint Sales.

Good to Know

  • The class eFormEvents contains these events. You can call a JavaScript method as eFormEvents.[eventname].

    Example:

    eFormEvents.onFormLoadComplete

Events

EventDescription

onAllFilesFetch

Description:
Occurs when all JavaScript files are loaded.
Example:
eFormEvents.SharedJS.onAllFilesFetch = function(eventArgs)
{
  // Functionality goes here
                                        
  // eventArgs – will contain list of JavaScript files. Each object will contain filename and its status.
  // eventArgs[0].fileName - Gives the JavaScript filename 
  // eventArgs[0].status - Gives the status of the JavaScript file
}
Limitations:
  • AgilePoint NX v7.0 Software Update 1 and higher.

onBeforeExportAsCSV

Description:
Occurs before export data as a CSV file in a subform.

This event supports for both Subform (Legacy) form control and Subform form control.

Example:
eFormEvents.subForm.onBeforeExportAsCSV = function (eventArgs, callback) { 
  //Functionality goes here
  eventArgs.fieldId // The internal name of the subform
  eventArgs.fieldPath // The field path of the subform
  eventArgs.fileName // The filename (label/dataname)
  callback(newFileName); // This callback is required to export the file in CSV format. 
                         // If it is not called, the file will be exported.
}
Limitations:
  • AgilePoint NX v8.0 and higher.

OnBeforePrint

Description:
Occurs before an eForm prints.
Example:
var options = eFormPrintPreference: { 
  // eFormPrintPreference contains 
  // the following properties and values by default
  // printType: options.printType = printConstants.printType.nativePrint;
  // settings: {canStartSectionOnNewPage: true, showFormBackgroundColor: false}
  // showConfigPopup: true
  
  eFormEvents.onBeforePrint = function (callback) {
  options.printType = printConstants.printType.nativePrint; 
  // Prints an eForm the way it shows in your web browser.
  // (or) options.printType = printConstants.printType.defaultPrint; 
  // Prints an eForm with the browser settings.
  
  options.settings.canStartSectionOnNewPage = true; 
  // Prints each section of an eForm on a different page. 
  // (or) options.settings.canStartSectionOnNewPage = false; 
  // Prints the form sections with no page breaks between sections.
  
  options.settings.showFormBackgroudColor = true; 
  // Shows the background color of an eForm in the print output.
  // (or) options.settings.showFormBackgroudColor = false; 
  // Does not show the background color of an eForm in the print output.
  
  options.showConfigPopup  = true; 
  // Shows the configuration pop-up screen.
  // options.showConfigPopup  = false; 
  // Does not show the configuration pop-up screen.
  
  // The values of options.settings.canStartSectionOnNewPage 
  // and options.settings.showFormBackgroudColor 
  // are only considered if the options.printType 
  // is equal to printConstants.printType.nativePrint.
  
  callback(options); 
  // This callback is required for the print form functionality. 
  // If it is not called, the form will not be printed.
  
}
Limitations:
  • AgilePoint NX v8.0 Software Update 2 and higher.

onBeforeSubmit

Description:
Occurs after a Before Submit rule is executed, and before the validation of the form controls and form sections.
Example:
eFormEvents.onBeforeSubmit = function (callback) 
{
  // Functionality goes here

  // This callback is mandatory for the form submission. 
  //  If it is not called, the form won't get submitted.
  callback (true);  
}

onEditRecord

Description:
Occurs when you change a record in a Subform form control if the Display Style field is set to Summary Columns.
Example:
eFormEvents.subForm.onEditRecord = function (eventArgs) { 
  //Functionality goes here
  eventArgs.fieldId  // The internal name of the subform
  eventArgs.fieldPath  // The field path of the subform
  eventArgs.data // The updated row data
}
Limitations:
  • This event supports only Subform form control, not the Subform (Legacy) form control.
  • AgilePoint NX v8.0 and higher.

OnFetch

Description:
Occurs when an incremented number is created in a Sequence Number form control.
Example:
eFormEvents.sequneceNumber.onFetch = function (eventArgs) { 
  // Functionality goes here
  // eventArgs.internalName
  // The internal name of the Sequence Number form control.
  
  // eventArgs.prefix 
  // The prefix for the Sequence Number form control.
  
  // eventArgs.suffix 
  // The suffix for the Sequence Number form control.
  
  // eventArgs.value 
  // The value that is configured to increase 
  // the incremented number in a series.
}
Limitations:
  • AgilePoint NX v8.0 Software Update 2 and higher.

onFileFetch

Description:
Occurs each time a JavaScript file loads.
Example:
eFormEvents.SharedJS.onFileFetch = function(eventArgs) 
{
  // Functionality goes here
                                        
  // eventArgs.fileName - Gives the JavaScript filename 
  // eventArgs.status - Gives the status of the JavaScript file
}
Limitations:
  • AgilePoint NX v7.0 Software Update 1 and higher.

onFormLoadComplete

Description:
Occurs when the form load is complete.
Example:
eFormEvents.onFormLoadComplete = function () 
{
     // Functionality goes here

}

onSectionNavigation

Description:
Occurs when all the form controls for the specified section is loaded.
Example:
eFormEvents.onSectionNavigation = function (eventArgs) 
{
  // Functionality goes here
  
  // eventArgs.currentSection - will give the current 
  // section's header
  
  // eventArgs.previousSection -  will give the previous section's 
  // header from where it got navigated.
}

onSubmit

Description:
Occurs after the form data is submitted.
Example:
eFormEvents.onSubmit = function () 
{
  // Functionality goes here
}

onValidationOnSubmit

Description:
Occurs after a Validation on Submit rule is executed, and before the form data is submitted.
Example:
eFormEvents.onValidationOnSubmit = function (callback) 
{
  // Functionality goes here

  // This callback is mandatory for the form submission. 
  // If it is not called, the form won’t get submitted.
  callback (true);  
}

onAddRecord

Description:
Occurs after a row is added in a subform.
Example:
eFormEvents.subForm.onAddRecord = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.element - Gives the subform element
  // eventArgs.dataName - Gives the internal name of the subform
  // eventArgs.newRow - Gives the row element

}

onDeleteRecord

Description:
Occurs after a row is deleted from a subform.
Example:
eFormEvents.subForm.onDeleteRecord = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.element - Gives the subform element
  // eventArgs.dataName - Gives the internal name of the subform
}

onCancelUpload

Description:
Occurs after a file upload is cancelled.
Example:
eFormEvents.FileUpload.onRemove = function (response) 
{ 
  // Functionality goes here
  // Response object holds the internal name of 
  // the File Upload form control 
  // and the uploaded file parameters.
  // Example: encodeURL, fileGuid, fileId, fieldname, 
  // itemId, status, uploadedBy, url                                      
                                        
                                        
}
Limitations:
  • AgilePoint NX v8.0 Software Update 2 and higher.

onCopyRecord

Description:
Occurs after a row is copied to a subform.
Example:
eFormEvents.subForm.onCopyRecord = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.element - Gives the subform element
  // eventArgs.dataName - Gives the internal name of the subform
  // eventArgs.newRow - Gives the row element
}

onAddRecord

Description:
Occurs after a row is added in a Data Grid form control.
Example:
eFormEvents.grid.onAddRecord = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.element - Gives the grid element
  // eventArgs.dataName - Gives the internal name of the grid
  // eventArgs.newRow - Gives the row element
  // eventArgs.rowData - Gives the JSON data for the newly added row

}

onDeleteRecord

Description:
Occurs after a row is deleted from a Data Grid form control.
Example:
eFormEvents.grid.onDeleteRecord = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.element - Gives the grid element
  // eventArgs.dataName - Gives the internal name of the grid
  // eventArgs.rowData - Gives the JSON data for the newly added row
}

onCancelRecord

Description:
Occurs after a row change is cancelled in a Data Grid form control.
Example:
eFormEvents.grid.onCancelRecord = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.element - Gives the grid element
  // eventArgs.dataName - Gives the internal name of the grid
  // eventArgs.cancelledRow - Gives the row element
  // eventArgs.rowData - Gives the JSON data for the newly added row
}

onSaveRecord

Description:
Occurs after a row is changed and then saved in a Data Grid form control.
Example:
eFormEvents.grid.onSaveRecord = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.element - Gives the grid element
  // eventArgs.dataName - Gives the internal name of the grid
  // eventArgs.savedRow - Gives the row element
  // eventArgs.rowData - Gives the JSON data for the newly added row
}

onDataBound

Description:
Occurs after a Data Grid form control binds data from a data source.
Example:
eFormEvents.grid.onDataBound = function (eventArgs) 
{
  // Functionality goes here
  // eventArgs.dataName - Specifies the internal name of the Data Grid
  // eventArgs.kendoInstance - Specifies the Telerik instance
}
Limitations:
  • AgilePoint NX v7.0 Software Update 2 and higher.

onPostUpload

Description:
Occurs after a file is uploaded to repository with the File Upload form control.
Example:
eFormEvents.FileUpload.onPostUpload = function (response) { 
  // Functionality goes here
  // After the file is uploaded to the repository
  // Response object holds uploaded file details 
  // For example: filename, fileId, url, size, uploadedBy, 
  // itemId, encodedURL
};
Limitations:
  • AgilePoint NX v8.0 and higher.

onPreUpload

Description:
Occurs before the File Upload form control starts to upload the file.
Example:
eFormEvents.FileUpload.onPreUpload = function (data, callback) { 
  // Functionality goes here
  // The data object holds control and file details
  // The structure of the data parameter
  fileInfo: {
  fileName,
  fileSize,
  fileType
  },
    controlInfo: {
    xPath,
    internalName
    }
  var modifiedData = {
  canUpload: true, // User can specify whether file can be uploaded or not
  newFileName: "NewName" + new Date().getTime() + "." + data.fileInfo.fileType, // New file name
  validationMessage: "User Defined Validation Message!" // Custom validation message to display 
                                                        // If the user sends canUpload as false
  };
  callback(modifiedData);
}
Limitations:
  • AgilePoint NX v8.0 and higher.

OnRemove

Description:
Occurs after a file is removed from a File Upload form control.
Example:
eFormEvents.FileUpload.onRemove = function (response) 
{ 
  // Functionality goes here
  // Response object holds the internal name 
  // of the File Uploadform control 
  // and the uploaded file parameters.
  // Example: encodeURL, fileGuid, fileId, 
  // fieldname, itemId, status, uploadedBy, url                                      
 
                                        
}
Limitations:
  • AgilePoint NX v8.0 Software Update 2 and higher.

printForm

Description:
Occurs when a form user clicks the Print button.
Example:
var options = {}
options.width = '800px';
eFormEvents.printForm = function(callback)
{
  // Functionality goes here
  // This callback is mandatory for the print form functionality. 
  // If it is not called, the form won't get printed.
  callback(options);
}
Limitations:
  • AgilePoint NX v7.0 Software Update 1 and higher.