Data objects
This topic describes and gives samples for data objects used within the Domino Leap JavaScript™ API.
Object | Description | Example |
---|---|---|
BO.<itemId> | Accesses the Business Object Attribute data for an individual item on the form. | Set the value of a number item on the form:
|
BO.setValid(valid, msg) | Setting valid to falseoverrides the validity of the form and prevents submission, showing the user the message provided. Setting valid to trueremoves any previous override. However, it will not override other ways in which the form might be invalid. |
Place this code in the onItemChange event
of a field to constrain the input to a specific value.
|
BO.getValid() | Returns the current value of the overridden valid state of the form as set by BO.setValid(). | |
BO.isValid() |
Returns true if every field in the form is valid and false otherwise.
This is different from getValid() which returns the overridden valid state of the form as set by BO.setValid(). |
|
BO.getInvalidMessages() |
This function returns an array of the error messages of any invalid fields in the form. If there are no invalid fields, the function returns an empty array. | |
BO.getCurrentStage() | Returns the current stage of the form. | If the form is in the Submitted stage then show the user a custom message in
the
onLoad:
|
BO.getDataId() | Returns the unique ID that represents this data item or will represent it if it has never been submitted. | |
BO.getChildren() | Returns a list object that provides access to all the individual Business Object Attribute data. The list object has getLength() function, and get(index) function for accessing the objects in the list. | |
BO.getByID | Returns the Business Object with the given ID |
The following syntax is used for this business object:
Where: |
Object | Description | Example |
---|---|---|
BOA.getValue() | Returns the current value. The type of the returned value depends on the type of item.
|
|
BOA.setValue(value) | Sets the value of this data item. The correct data type should be provided
based on the Business Object Attribute’s type. Some type
conversion is done where possible, for example, a Number
converted to a String. Attachment: takes an object
with a Name Picker: takes an object
with a minimum of an |
|
BOA.getId() | Returns the ID of this data item that is unique per form. | |
BOA.getBO() | Returns the Business Object for the entire form. | |
BOA.getType() | Returns a string that indicates the type of data. For example, string, number, boolean, currency, time, date, timeStamp, or attachment. | |
BOA.connectEvent(eventName, callbackFunction) | Used for connecting an event listener to a Business
Object Attribute. You can define code to execute when the listener
detects that the event is triggered. The only supported event for
a Business Object Attribute is onChange. Note: If
you connect an event, it must be disconnected using BOA.disconnectEvent(eventHandle). |
Place this in the onShow event of the field to
display a message box when the item
changes.
|
BOA.disconnectEvent(eventHandle) | Disconnects the event handler specified by the passed-in event handle object that was returned by a BOA.connectEvent call. If you create a listener in the event of a form object, you must disconnect it. Otherwise, duplicate listeners are created every time the event is triggered. |
|
BOA.setValid(valid, msg) | You can override valid data to be invalid with
this method. By passing false, you cause the data to be invalid, and prevent submission. You can optionally provide a custom error message. Setting the valid to trueclears any previously overridden valid value. Note: You cannot set a Business Object Attribute to valid
which actually has invalid data, or is set invalid by a rule. |
Force the user to enter more than 3 characters
for their name by adding this code to the items onItemChange:
|
BOA.getValid() | Gets a value set previously using setValid(). | |
BOA.setRequired(required) | You can override non-required data to be required
with this method. By passing true, you cause its data to be required and prevent submission if it is not set. Setting the valid to falseclears any previously overridden value. Note: If a
Business Object Attribute has been set as required by a property or
by a Rule, you cannot make it unrequired. |
|
BOA.getRequired() | Gets a value set previously using setRequired(). | |
BOA.isValid() | Returns true if the data is valid. Returns false if the data is invalid. | |
BOA.getInvalidMessage() | Returns the current error messages for this data, or null if the data is valid. | |
BOA.isRequired() | Returns true if this item is required. | |
BOA.isMissing() | Returns true if this item is required and it has no value. | |
BOA.validate() | Triggers the validation of the data item. |
Object | Description |
---|---|
BOL.getLength() | Returns the number of Business Objects in the list. |
BOL.get(index) | Returns the Business Object at the specified index. |
BOL.createNew() | Creates a new empty Business Object ready to be inserted into the list using the add() method. |
BOL.add(bo) | Adds a Business Object of the appropriate type to the list. Can be one created with a call to the createNew() method or removed from the list with a remove() call. |
BOL.remove(bo) | Removes the Business Object from the list. Returns true if successful, false if not. |
BOL.getId() | Returns the ID of this data item that is unique per form. |
BOL.getType() | Returns a string that indicates the type of Business Object List data. |
BOL.setValid(valid, msg) | You can override valid data to be invalid with
this method. By passing false, you cause its
data to be invalid and prevent submission. You can optionally provide
a custom error message. Setting valid to true clears
any previously overridden valid value. Note: You cannot set a Business
Object List to valid that actually has invalid data, or is set invalid
by a rule. |
BOL.getValid() | Gets a value set previously using setValid(). |
BOL.setRequired(required) | You can override non-required data to be required
with this method. By passing true, you cause
its data to be required and prevent submission if it is not set. Setting
the valid to false clears any previously overridden
value. Note: If a Business Object Attribute has been set as required
by a property or by a Rule, you cannot make it unrequired. |
BOL.getRequired() | Gets a value set previously using setRequired(). |