Custom.js File

The first time you generate the Mobile Workflow package files, the Custom.js file is generated.

In subsequent file generations for the same Mobile Workflow package, this file will not be overwritten, so any customizations you make are preserved. The Custom.js file contains these methods:

Method Description
customBeforeWorkflowLoad() Invoked when the application is first launched, before any data is loaded or screens are opened.
customAfterWorkflowLoad() Invoked when the application is first launched, after data is loaded and screens are opened.
customBeforeSubmit(screenKey, requestAction) Invoked before an operation or object query is about to be called as the result of the user clicking a Submit menuitem.

User can return false to prevent the default behaviour from occurring.

customAfterSubmit(screenKey, requestAction) Invoked after an operation or object query is called as the result of the user clicking a Submit menuitem.
customBeforeNavigateForward(screenKey, currentScreenKey) Invoked when another screen is about to be opened.

User can return false to prevent the screen from being opened.

customAfterNavigateForward(screenKey, currentScreenKey) Invoked after another screen has been opened.
customBeforeNavigateBackward(screenKey, destScreenKey) Invoked when a screen is about to be closed.

User can return false to prevent the screen from being closed.

customAfterNavigateForward(screenKey, currentScreenKey) Invoked after a screen has been closed.
customBeforeShowScreen(screenToShow, screenToHide) Invoked when a screen is about to be shown.

User can return false to prevent the screen from being shown.

customAfterShowScreen(screenToShow, screenToHide) Invoked after a screen has been shown.
customValidateScreen(screenKey, values) Invoked when the contents of a screen need to be validated.

User can return false to indicate that the contents of the screen are not valid.

customBeforeMenuItemActivate(screenKey, menuItemName) Invoked after a menuitem has been clicked. User can return false to prevent the default behaviour (which might open a new screen, or perform a submit, and so on) from occurring.
customAfterMenuItemActivate(screenKey, menuItemName) Invoked after a menuitem has been clicked and the default behavior has occurred.
customBeforeSave(screenKey) Invoked before a screen’s contents are about to be persisted to the Mobile Workflow message.

User can return false to prevent the default behaviour from occurring.

customAfterSave(screenKey) Invoked after a screen’s contents have been persisted to the Mobile Workflow message through the default logic.

Example 1

//Use this method to add custom html to the top or bottom of a form
function customBeforeWorkflowLoad() {

	var form = document.forms[curScreenKey + "Form"];
	   if (form) {
	      // header
	      var topOfFormElem = document.getElementById("topOf" + curScreenKey + "Form");
	      
	      if (topOfFormElem) {
	         topOfFormElem.innerHTML = "<img id='ImgSylogo' src='./images/syLogo.gif'/><br/>";

	         // footer
	         var bottomOfFormElem = document.getElementById("bottomOf" + curScreenKey + "Form");
	         bottomOfFormElem.innerHTML = "<p>Copyright 2010, Sybase Inc.</p>";
	      }
	   }
    return true;
}