Interface objects

This topic describes and gives samples for interface objects that are used within the HCL Domino Volt JavaScript API.

Note: When you use JavaScript to modify form items, the change appears only in the user interface, it does not persist to the submitted data. The user completing the form sees the modifications that are made by your JavaScript, however a user reviewing submitted data sees the original form items. If you want the changes to appear in the form any time it is viewed, the JavaScript must be attached to events that run each time that the form is opened.
Table 1. Application Object (app) The Domino Volt application object provides access to information relevant to the whole application.
Object Description Example
app.getCurrentUser() Returns the identifying name of the currently logged in user. The identifying name is the property as defined by the ibm.was.MemberManager.userProps.id property that is located in the Leap_config.properties file. For example, uid, cn, mail, displayName. If the Initiator Role is set to Anonymous User, then the function returns the string Anonymous Guest User. To populate the current user's login name into a field in the form, place the following statement in the onLoad event of the form:
Note: The following code must be entered as a single line.
//change F_SingleLine to the ID of the desired field 
BO.F_SingleLine.setValue(app.getCurrentUser());
app.getFileBaseURL() Returns the relative URL to the current browser page where all files that are uploaded into the application at design time are stored. This does not include images and CSS files. All files are saved as anonymous resources that can be viewed by anyone. An example url is ../../../../../anon/1/content/8.6.0.363/97eeb588-2fff-49a7-89c1-5000885dafb4/1421171344944-2/desktop/en/en/en/desktop/files/
app.getForm(formID) Returns the user interface form object for the provided formID. If used to return a form that is not shown or loaded, then the object that is returned is not fully operational and should be used for hooking up dynamic event handlers only. Register an event listener to a service in order to do something when it returns:
var form = app.getForm('F_Form1');
     var service = form.getServiceConfiguration('SC_ServiceConfig0');

     service.connectEvent('onCallFinished', function(pSuccess)
     {
     alert('call finished');
     });
app.getImageBaseURL() Returns the relative URL to the current browser page where all images that are uploaded into the application at design time are stored. All images are saved as anonymous resources that can be viewed by anyone. An example url is ../../../../../anon/1/content/8.6.0.363/97eeb588-2fff-49a7-89c1-5000885dafb4/1421171344944-2/desktop/en/en/en/desktop/image/

app.getLocation(callbackFunction, highAccuracy)

Allows the form designer to get the current user's location.

callbackFunction - the callback that occurs after the location request finishes. The designer must define the function to have one argument which will be assigned a Position object if the location request was successful, or null if the request was unsuccessful. Inside the function the designer can assign location attributes to different fields. Five values can be accessed:

  • position.coords.latitude
  • position.coords.longitude
  • position.coords.accuracy
  • position.coords.altitude
  • position.coords.altitudeAccuracy

More information in https://developer.mozilla.org/en-US/docs/Web/API/Position/.

highAccuracy - a boolean value that requests a high accuracy location from the browser if true. See https://developer.mozilla.org/en-US/docs/Web/API/PositionOptions/enableHighAccuracy.

Set the value of F_SingleLine1 to the current location:


var highAccuracy = true;
var myCallbackFunction = function (position) {
  if (position !== null) {
    BO.F_SingleLine1.setValue(position.coords.latitude+", "+position.coords.longitude);
  } else {
    alert("Location request failed");
  }
};
app.getLocation(myCallbackFunction,highAccuracy);
app.getSharedData() Returns a JavaScript object that can be easily accessed from all custom JavaScript code on the form, and is the suggested location to share data, or create reusable functions. Create some data and functions to be used later:
app.getSharedData().titleToShow = 'Welcome Form';
     app.getSharedData().addTwoValues = function(v1,v2)
     {
     return v1 + v2;
     };
Example of referencing the established variable and function:
BO.F_SingleLine.setValue(app.getSharedData().titleToShow);
BO.F_Number.setValue(app.getSharedData().addTwoValues(5, 5));
app.getStyleBaseURL() Returns the relative URL to the current browser page where all CSS style files that are uploaded into the application at design time are stored. All css files are saved as anonymous resources that can be viewed by anyone. An example url is ../../../../../anon/1/content/8.6.0.363/97eeb588-2fff-49a7-89c1-5000885dafb4/1421171344944-2/desktop/en/en/en/desktop/styles/
app.getSuppressWarning() Gets the current set value for suppressing the warning. See setSuppressWarning for information.
var suppressWarning = app.getSuppressWarning();
if(suppressWarning === false)
  app.setSuppressWarning(true);
app.getUID() The UID of the application Can be used to create a link to another form
page.F_StaticWebLink.setLinkValue(BO.F_ServerURL.getValue() + '/apps/secure/1/app/' + app.getUID() + '/launch/index.html?form=F_Form2'));
app.getUrlParameter(parm) Looks up a single parameter.
var param= app.getUrlParameter('debug')
if(param === 'true')
   alert('Shown only when debug param is present');
app.getUrlParameters() Returns an object with all URL parameters.
var params = app.getUrlParameters();
     if(params.CustomWarning)
     alert(params.CustomWarning);
app.isSingleFormView() Returns true if the form is shown by itself in the browser and false if it is shown in view responses.
app.setSuppressWarning(pSuppress) If a user interacts with a form, or JavaScript, they are prompted with a warning message whenever the current browser page tries to navigate to a different URL. This function allows the suppression of that warning. When set to true the message is suppressed until it is set to false again Can be used at any scope, for example in the application onStart, form onLoad, onItemChange, etc.
app.setSuppressWarning(true);

app.showMessage(title, message, type, subtitle)

Allow usage of a built-in dialog for end-user messages.

title: The title to display in the dialog title bar.

message: The message text to display.

type (optional): can be one of "info", "success", "warn", or "error" and results in appropriate icon being displayed. If type is absent or not one of these values, then no icon will be displayed.

subtitle (optional): Heading text for the message.

app.showMessage
("Error found in data",
 "The booking date cannot be after the event.",
 "error",
 "Please change the booking or event date, then re-submit.");
Table 2. Form Object (form) The form object provides access to a number of functions that affect the entire form.
Object Description Example
form.addClasses(classes) Adds a list of custom class names to the form for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names. If any of the given class names are invalid CSS class names, then no classes are added and false is returned.
form.addClasses(emphasized error);
form.backwardPage() Return the form to the previous page in navigation order. If the first page is reached, then nothing happens. The following could be used to turn a regular button into a navigation button. In the onClick event of a button:
form.backwardPage();
form.connectEvent(eventName, callbackFunction) Connects a function to an event on the form. This is useful for utility functions defined in external JavaScript files to hook behavior into the form dynamically. Returns a handle object that represents the connection of the function to that event name. The handle can be used to disconnect this same event using form.disconnectEvent. If there is a F_CurrentUser field, then populate the currentUser:
var hndl = form.connectEvent('onLoad', function()
     {
     if(form.getBO().F_CurrentUser)
form.getBO().F_CurrentUser.setValue(app.getCurrentUser());
     }
     });
form.disconnectEvent(eventHandle) Disconnects the event handler specified by the passed-in event handle object that was returned by a form.connectEvent call.
form.disconnectEvent(hndl);
form.forwardPage() Advance the form to the next page in navigation order. If the last page is reached, then nothing happens. The following could be used to turn a regular button into a navigation button. In the onClick event of a button:
form.forwardPage();
form.getApp() Returns the application object: app. Not a commonly used function, because within the form scope the app variable is also available.
form.getBO() Returns the object that contains the Business Object data for the entire form. This is commonly used in the application onStart, since at this scope the form variable is not defined.
var myForm = app.getForm('F_Form1');
var formBO = myForm.getBO();
formBO.F_SingleLine.setValue('setting the value using code!');
form.getClasses() Returns an Array of custom class names currently applied to the form.
form.getCurrentPage() Gets the currently shown page. If there is no page shown, then null is returned. It is possible, though rarely desirable, to have all pages hidden.
var pageShown = form.getCurrentPage();
if(pageShown === 'F_Page1')
  pageShown.F_Text.setContent('Changing the text of this text item when this page is shown.');
form.getId() Returns the unique ID within the application of this form. For example, F_Form1.
form.getPageIds() Returns an array of the page IDs for the pages in this form.
form.getPage(pageId) Returns the page object, page, for the page specified. Returns null if the pageId is invalid. Get the specified page:
 var thePage = form.getPage('F_Page1');
If the page exists then, navigate to that page:
if(thePage !== null) 
  form.selectPage('thePage')
form.getServiceConfigurationIds() Returns an array of all the IDs for services mapped in this form.
var serviceConfigs = form.getServiceConfigurationIds();
form.getServiceConfiguration(serviceId) Gets the service object for a particular service ID. Lookup and execute a service from JavaScript:
var service = form.getServiceConfiguration('SC_ServiceConfig');
     service.callService();
form.getStageActions() Returns an array of all the action buttons for the current stage. This includes any hidden action buttons as well. Trigger a specific action using JavaScript:
var actions = form.getStageActions():
for(var i=0; i<actions.length; i++)
     {
     if(get(actions,i).getId() === 'S_Submit')
     {
     get(actions,i).activate();
     break;
     }
     }
form.getType() Returns a string identifying the object type. For example, form.
form.removeClasses(classes) Removes a list of custom class names from the form for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names.
form.removeClasses(emphasized);
form.removePageFromNavigation(pageId) Removes the specified page from the navigation list for the form. The page navigation item no longer visits that page when next, or previous is selected, nor can you switch to that page programmatically. If the check is selected, remove page 2 from the navigation:
if(BO.F_Check.getValue)
  form.removePageFromNavigation('P_Page2');
 
form.restorePageNavigation(pageId) Restores a previously removed page back into the navigation list for the form. If the check is not selected, restore page 2 into the navigation:
 if(!BO.F_Check.getValue)
  form.restorePageNavigation('P_Page2');
form.selectPage(pageId) Switches to the specified page. If the page is removed from navigation by Stages, Rules, or JavaScript, then you cannot select it. Get the specified page:
 var thePage = form.getPage('F_Page1');
If the page exists then navigate to that page:
if(thePage !== null) 
  form.selectPage(thePage);
form.sendData(data) For IBM® WebSphere® Portal only. When hosted in a portlet, calling this method sends the string to any subscribers to the portlet. The content of this string depends on the portlet that consumes it. Send a URL to be processed by the wire connected to the portlet:  
form.sendData(BO.F_ServerURL.getValue() + "/apps/secure/org/app/b5806ef1-b784-4c85-8844-653cd4064201/launch/index.html?form=F_FormA"); 
Table 3. Page Object (page) The page object represents a particular page, and provides access to its items and properties.
Object Description Example
page.<itemId> Provides convenient direct access to all items on the page, including those inside Sections and Tab Folders. Hide a specific button on the page:
page.F_NextButton.setVisible(false);
page.addClasses(classes) Adds a list of custom class names to the page for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names. If any of the given class names are invalid CSS class names, then no classes are added and false is returned.
page.addClasses(emphasized error);
page.connectEvent(eventName, callbackFunction) Connects a function to an event on the page. The list of events is the same as for the page in the Design interface. Useful for utility functions defined in JavaScript files to hook behavior into the page dynamically. Returns a handle object that represents the connection of the function to that event name. That handle can be used to disconnect this same event using page.disconnectEvent.
page.disconnectEvent(eventHandle) Disconnects the event handler specified by the passed-in event handle object that was returned by a page.connectEvent call. To avoid duplicate event handlers being connected to pages, connect to page events from within the application onStart or form onLoad events. If you connect to a page event outside of these two events you should explicitly disconnect from the page event using the disconnectEvent method.
page.getBO() Returns the object that contains the Business Object data for the entire form.
var theBO = page.getBO();
theBO.F_SingleLine.setValue('new Value');
page.getChildren() Returns the list object that provides access to all direct children items for this page. For example, items in a Section on the page are not in the list, however the Section itself is. The list object has the getLength() function and get(index) function for accessing the objects in the list. Hide all button items on a page:
var list = page.getChildren();
     for(var i=0; i<list.getLength(); i++)
     {
     if(list.get(i).getType() === 'button')
     list.get(i).setVisible(false);
     }
page.getClasses() Returns an Array of custom class names currently applied to the page.
page.getForm() Returns the form object to which this page belongs.
page.getId() Returns the unique ID, within the application, of this page. For example, P_Page1.
page.getType() Returns a string identifying the object type. For example,page.
page.getVisibility() Returns true if the page is being shown, and false if it is hidden.
page.removeClasses(classes) Removes a list of custom class names from the page for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names.
page.removeClasses(emphasized);
Table 4. Item Object (item) The item object represents a particular item on a page, and provides access to its properties. For Sections and Tab Folders, access to their child items is also granted.
Object Description Example
item.addClasses(classes) Adds a list of custom class names to an item for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names. If any of the given class names are invalid CSS class names, then no classes are added and false is returned.
item.addClasses(emphasized error);
item.clearRequiredMessage() Validates the item data, but prevents the required error message from displaying.
item.connectEvent(eventName,callbackFunction) Connects a function to an event on the item. Useful for utility functions defined in external JavaScript files to hook behavior into the item dynamically. Returns a handle object that represents the connection of the function to that event name. That handle can be used to disconnect this same event using item.disconnectEvent. Connect a listener to the onItemChange event to make a section visible. This could be placed in the form onLoad event: 
var hndl = item.connectEvent('onItemChange', function()
     {
     if(item.getBOAttr().getValue() === 'Yes')
form.getBO().F_SectionA.setVisible(true);
     }
     });
item.disconnectEvent(eventHandle) Disconnects the event handler specified by the passed-in event handle object that was returned by an item.connectEvent call.

If you connect an item event, you must also disconnect it in the same event. Otherwise, multiple versions of the connected code are attached every time the event is triggered.

If the connect event is placed in the item onShow then the listener needs to be disconnected:
item.disconnectEvent(hndl);
item.getActive() Returns true if this item is active, or false if it is made read only by a rule, stage, or JavaScript.
item.getBO() Returns the Business Object for the entire form.
item.getBOAttr() An interface item that is collecting data, this method returns the Business Object Attribute that contains that data. If it is an interface-only item, then it returns null. Get data for an item and set its value:
item.getBOAttr().setValue(45);
item.getChildren() If this item contains children, for example Section, or Tab Folder, it returns a list object that provides access to all direct children items. The list object has the getLength() function and get(index) function for accessing the objects in the list. Rest all numbers inside a section to 0:
var list = item.getChildren();
     for(var i=0; i<list.getLength(); i++)
     {
     if(list.get(i).getType() === 'number')
     list.get(i).getBOAttr().setValue(0);
     }
item.getClasses() Returns an Array of custom class names currently applied to an item.
item.getDisplayValue() Returns the current value that is being displayed. It can be used in onItemLiveChange to get current, but not yet committed value.
item.getHoverText() Returns the current value set as hover text.
item.getHintText() Returns the value set as Hint text.
item.getId() Returns the unique ID, within the application, of this item. For example, F_FirstName.
item.getPage() Returns the page object to which this item belongs. Get the form object:
var form = item.getPage().getForm();
item.getParent() Returns the object that is the direct parent of the item, which can be a page, section, or tab folder.
item.getPlaceholderText() Returns the current value set as place holder text.
item.getRows() Returns the current value set as the number of rows displayed. This method gets the number of rows the text area displayed.
Note: This parameter works only on multi-line input areas.
item.getStartLabel() This method gets the value of the label displayed at the start of a numeric or choice slider.
item.getStopLabel() This method gets the value of the label displayed at the end of a numeric or choice slider.
item.getStyle() Returns the current value set for display style.
Note: This parameter works only on Date and Time input fields.
item.getTitle() Returns the current value used as the field title.
item.getType() Returns a string identifying the object type.
Table 5. List of item types
Palette item Type Palette item Type
Attachment attachment Paragraph Text textArea
Button button Password password
Check Box checkBox Section section
Currency currency Select Many checkGroup
Date date Select One radioGroup
Dropdown comboBox Single Line text
Email Address emailAddress Survey survey
Folder Tab tabFolderTab Survey Question surveyQuestion
HTML Fragment htmlArea Tabbed folder tabFolder
Image image Table aggregationListContainer
Line horizontalLine Text richText
Media media Time time
Number number Timestamp timeStamp
Numeric Slider horizontalSlider Web Link staticWebLink
Page page Website weblink
Page Navigation pageNavigator
item.getVisible() Returns true if this item is visible (does not take into account which page is being shown) or false if it is hidden by a rule, stage, or JavaScript, or if its parent is hidden.
item.removeClasses(classes) Removes a list of custom class names from an item for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names.
item.removeClasses(emphasized);
item.setActive(active) Sets whether this item is inactive, or read only.
Note: If this item is made inactive by a rule or stage, then you cannot make it active with JavaScript.
item.setDisplayValue(pValue) Takes a string or number in pValue. This method sets the value being displayed. If the user is editing, then it will update the value they are trying to enter. If the user is not editing, then it will be the same as setValue(). This method works on direct input items such as single line, multi line, number, currency, email and website.
item.setFocus() Causes this item to receive focus. This option has no effect on items that cannot have focus, are invisible, or are read-only.
item.setHintText(pValue) Takes a pValue string. This method sets the text that is used for hover text on input items. If an empty value is provided, the hint text area is removed.
item.setHoverText(pValue) Takes a pValue string. This method sets the text that is used for Hint text on input items. If an empty value is provided, no hover help is displayed.
item.setRows(pValue) Takes a pValue number. This method sets the number of rows the text area displays.
Note: Whenever possible, do not exceed 40 rows.
item.setPlaceholderText(pValue) Takes a pValue string. This method sets the text used as placeholder text on input items.
item.setStartLabel(pValue) Takes a pValue string. This method sets the value of the label displayed at the start of a numeric or choice slider.
item.setStopLabel(pValue) Takes a pValue string. This method sets the value of the label displayed at the end of a numeric or choice slider.
item.setStyle(pValue) Takes a pValue string. This method sets the style used to display time and dates. Valid values are numeric, short, medium, long, and full. Valid values for time are numeric, short and medium.
item.setTitle(pValue) Takes a pValue string. This method sets the text used for a field titles on input items. If an empty value is provided, the title is removed.
item.setVisible(visible) Sets whether this item is visible.
Note: If this item is made invisible by a rule or stage, or because a parent is hidden, then you cannot unhide it by calling this function.

item.getColumnHeaders()

Returns a JSON object that contains the id, title and width of each header displayed for the table.

Sample JSON output:
[{id:"F_Currency1",title:"La Currency",width:20},
{id:"F_Date1",title:"La Date"}]
var headers =  page.F_Table1.getColumnHeaders();
for(var h in headers) {
  alert("ID=" + get(headers,h).id +
  ", title=" + get(headers,h).title + 
  ", width=" + get(headers,h).width);
}

item.setColumnHeaders(headers)

Function accepts a JSON object that can be used to set the id, title and width of each column in the table.

This is helpful, for example, to change the language of the column header displayed.

var headers = new Array();
set(headers, 0, {id: "F_Currency1",
	title: "La Currency", width: 20});
set(headers, 1, {id: "F_Date1", title: "La Date"});
page.F_Table1.setColumnHeaders(headers);
Note: The item.setTitle parameter is not applicable to Tabbed Folder form items. For Tabbed folder parameters, see Table 12 - Tabbed Folder only.
Table 6. Item Object - Drop Down only
Object Description Example
item.getOptions() Returns the array of options currently shown in the drop-down. Each object in the array has a title property that is shown in the interface, and a value property that is saved into the data. Get the title of a specific dropdown value:
var theTitle = “”;
var opts = page.F_DropDown.getOptions();
for(var i=0;i<opts.length;i++) 
  var theItemTitle = get(get(opts,i), 'title');
  var theItemValue = get(get(opts,i), 'value');
  if(theItemValue === 'Red') {
   theTitle = theItemTitle;
  }
}
item.setOptions(options) Changes the list of options to show in the drop-down. It must be an array of objects. Each object must have a title property that is shown in the interface, and a value property that is saved into the data. Provide custom list for the drop-down:
var options = new Array();
     options.push({title:'Banana',value:'BA'});
     options.push({title:'Apple',value:'AP'});
     options.push({title:'Orange',value:'OR'});
     item.setOptions(options);
Table 7. Item Object - Weblink only
Object Description
item.setDisplayValue(display) Sets the display value that the user sees as the link in the browser.
item.setLinkValue(link) Sets the URL to which the link navigates when this item is clicked.
Table 8. Item Object - HTML Fragment only
Object Description
item.getContent() Gets the currently shown content for this interface item.
item.setContent(content) Shows content in this interface only item. The content is evaluated as HTML code.
Table 9. Item Object - Text only
Object Description
item.setContent(content) Shows content in this interface-only item. In Text, it is the raw text to show, no special formatting is supported.
Table 10. Item Object - Button only
Object Description
item.setContent(content) Sets the label that is shown on the button.
Table 11. item Object - Image only
Object Description
item.getHeight() Returns the current image height. Can be zero or blank.
item.getURL() Gets the current URL shown by this image item.
item.getWidth() Returns the current image width. Can be zero or blank.
item.setHeight(height) Sets explicit height in pixels for the image. Setting 0 removes the explicit height.
item.setURL(newURL) Sets the URL shown by this image item.
item.setWidth(width) Sets explicit width in pixels for the image. Setting 0 removes the explicit width.
Table 12. Item Object - Section only
Object Description
item.getExpanded() Returns true if the section is expanded and false if it is collapsed.
item.setExpanded(expanded) Sets the expanded state of the section. If true, the section is expanded. If false, then it is collapsed.
Table 13. Item Object - Tabbed Folder only
Object Description Example
item.getSelectionIndex() Returns the index of the currently selected tab. Set 12 into the first item in the currently shown tab:
var sel = item.getSelectionIndex();
     var tabs = item.getChildren();
     var selTab = tabs.get(sel);
     var tabChildren = selTab.getChildren();
     tabChildren.get(0).getBOAttr().setValue(12);
item.getTabTitleList() Returns an array of all the tab titles in this folder.
item.setSelectedTab(tabTitle) Takes a tabTable string. Selects the Tab that matches the tabTable string.
item.setTabTitle(tabIndex,pTitle) Updates the title of a tab within a Tabbed Folder by using a tabIndex integer and pTitle string value. tabIndex denotes the location of the tab within the list of available tabs from left-to-right. For bidirectional languages, the order is right-to-left.

On the form, a Tabbed folder contains 5 tabs: Red, Orange, Yellow, Green, Blue. The default start number of the tabIndex is 0.

In our example tabbed folder, the tabIndex number 0 is the Red tab which is furthest left, while 4 is the tab furthest to the right.

In a bidirectional language, the order is reversed. Tab 0 is assigned to Blue, which is the tab furthest to the right.

item.setTabTitleList(pTitleArray) Updates the titles of tabs within a Tabbed Folder from a list of strings by using a pTitleArray array of string values. The list of tabs is updated respective to the order of strings that are defined in the array. If there are more array values than tabs in the form, the additional values are ignored.
item.setTabTitleList(['Monday','Tuesday','Wednesday','Thursday','Friday']);
Table 14. Item Object - Table only See the Business Object List on the Data Objects page for more Table functionality.

Object Description Example
item.getSelection() Returns the Business Object of the selected row or null if there is no selection.
item.setSelection(BO) Selects the last Business Object in the table. Select that last row in the table:
var lastIndex = item.getBOAttr().getLength()-1;
     var lastRow = item.getBOAttr().get(lastIndex);
     item.setSelection(lastRow);
item.showAdd(show) If show is true, then the Add button is made visible.

If false, then the Add button is hidden.

item.showEdit(show) If show is true, then the Edit button is made visible.

If false, then the Edit button is hidden.

item.showRemove(show) If show is true, then the Remove button is made visible.

If false, then the Remove button is hidden.

Table 15. Item Object - Survey only
Object Description
item.getOptions() Returns an array of all the options for the survey questions. Each option has a value property, that gets saved in the data, and a display property, the title of at the beginning of the survey.
Table 16. Service Configuration Object This object represents a mapped service in the form and is retrieved using form.getServiceConfiguration().
Object Description Example
service.callService() Executes the service.
service.connectEvent(eventName, callbackFunction) The only supported event is onCallFinished, which is called every time after the service mapping is executed. It is passed a single parameter pSuccess, which indicates whether the service call succeeded. Resister these events in the Applications onStart event so that they are only registered once. Register an event listener in onStart() to a pre-populated service that makes a section visible on the page when the service finishes:
var form = app.getForm('F_Form1');
     var serviceConfig = form.getServiceConfiguration('SC_ServiceConfig');
     serviceConfig.connectEvent('onCallFinished', function(success)
     {
     if(success)
     {
     var page1 = form.getPage('P_Page1');
     page1.F_Section.setVisible(true);
     }
     });
service.disconnectEvent(eventHandle) Disconnects the event handler specified by the passed-in event handle object that was returned by a service.connectEvent call.
Table 17. Stage Action Button Object Represents an action button that is retrieved by calling form.getStageActions().
Object Description
action.activate() Triggers this button, which cancels, submit or save the form.
Note: If a button is hidden by a Rule, you can try and fire it. However, the server rejects the submission.
var actionButtons = form.getStageActions();
for(var i=0; i<actionButtons.length; i++){
  if(get(actionButtons, i).getId() === 'S_Cancel')
     get(actionButtons, i).activate();
}
action.addClasses(classes) Adds a list of custom class names to an action for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names. If any of the given class names are invalid CSS class names, then no classes are added and false is returned.
action.addClasses(emphasized error);
action.getActionType() Returns a string that identifies the type of the button. Values are Cancel, Submit, and Save.
action.getActive() Returns true if this button is active, and false if it is disabled.
action.getClasses() Returns an Array of custom class names currently applied to an action.
action.getId() Returns the unique ID (within the application) of this action button S_Submit.
action.getTitle() Returns the user-defined title of this button.
action.getVisible() Returns true if this button is visible, or false if it is hidden by a rule or JavaScript.
action.removeClasses(classes) Removes a list of custom class names from an action for dynamic CSS styling. The classes parameter can be a single class name, multiple class names separated by spaces, or an Array of class names.
action.removeClasses(emphasized);
action.setActive(active) If active is true, then the button is made active. If false, the button is disabled.
action.setFocus() Causes this button to receive focus, if possible.
action.setTitle(title) Sets the title for the button.
action.setVisible(visible) Sets whether this action is visible.
Note: If this item is made invisible by a rule, then you cannot unhide it by calling this function.