Interface objects
This topic describes and gives samples for interface objects that are used within the HCL Domino Volt JavaScript™ API.
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.
|
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:
|
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:
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:
|
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: Example of referencing the established variable and function:
|
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. |
|
app.getUID() | The UID of the application | Can be used to create a link to another form
|
app.getUrlParameter(parm) | Looks up a single parameter. |
|
app.getUrlParameters() | Returns an object with all URL parameters. | |
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.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. |
|
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.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.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:
|
form.disconnectEvent(eventHandle) | Disconnects the event handler specified by the passed-in event handle object that was returned by a form.connectEvent call. |
|
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.getApp() | Returns the application object: app.
Not a commonly used function, because within the form scope the appvariable 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 formvariable is not defined.
|
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. |
|
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: If the page exists then,
navigate to that
page:
|
form.getServiceConfigurationIds() | Returns an array of all the IDs for services mapped in this form. |
|
form.getServiceConfiguration(serviceId) | Gets the service object for a particular service ID. | Lookup and execute a service from JavaScript™:
|
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™:
|
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.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: |
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:
|
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: If
the page exists then navigate to that page:
|
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:
|
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.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.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. |
|
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:
|
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. |
|
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.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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.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.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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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. |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.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:
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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. |
|
Object | Description | Example |
---|---|---|
item.getOptions() | Returns the array of options currently shown
in the drop-down. Each object in the array has a titleproperty that is shown in the interface, and a valueproperty that is saved into the data. |
Get the title of a specific dropdown value:
|
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 titleproperty that is shown in the interface, and a valueproperty that is saved into the data. |
Provide custom list for the drop-down:
|
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. |
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. |
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. |
Object | Description |
---|---|
item.setContent(content) | Sets the label that is shown on the button. |
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 0removes 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 0removes the explicit width. |
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. |
Object | Description | Example |
---|---|---|
item.getSelectionIndex() | Returns the index of the currently selected tab. | Set 12 into the first item in the currently
shown tab:
|
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. |
|
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:
|
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. |
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. |
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:
|
service.disconnectEvent(eventHandle) | Disconnects the event handler specified by the passed-in event handle object that was returned by a service.connectEvent call. |
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. |
|
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.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.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. |