Public Script Functions

The PublicFunctions.js file defines global functions and constant values for enumerated types for use in scripts.

Global Functions

Function Description

CreateAttachmentsNameSizeEnum

CreateAttachmentsNameSizeEnum() As IGrooveNameValueEnum


If the current form has one or more attachments, this function returns an enumeration of name-value pairs, where the name is the name of the attachment and the value is the size of the attachment. If there is an attachment field, but there are no attachments, this function returns an IGrooveNameValueEnum with no values. If there is no attachment field on the current form, this function returns null.

CreateBSTREnumFromArray

CreateBSTREnumFromArray(i_StringArray) As IGrooveBSTREnum

Converts an array of strings into an enumeration object and returns the IGrooveBSTREnum object. This object can be used as an input parameter in some IGrooveFormsToolUIDelegate methods. This function can be called from macros as well as scripts.

CreateUniqueID

CreateUniqueID() As String


Returns a unique string ID in the same form used when text fields are initialized to a unique value. This function can be called from macros as well as scripts.

DisableField

DisableField(i_FieldName)


Disables a field. Note that if this method attempts to disable a field that cannot be disabled, the method has no effect. For compatibility with previous versions, this function takes an optional second parameter, i_bDisable, which is not shown in the function syntax. If i_bDisable is specified and has a FALSE value, this function is equivalent to EnableField(i_FieldName).

DoesFunctionExist

DoesFunctionExist(i_FunctionName) As Boolean


Checks if a global script function is implemented in the version of Groove running on the device. Specify the function name as a string. This function can be called from macros as well as scripts.

EnableField

EnableField(i_FieldName)


Enables a field. This function takes an optional second parameter, i_bEnable, which is not shown in the function syntax. If i_bEnable is specified and has a FALSE value, this function is equivalent to DisableField(i_FieldName).

GetApp

GetApp() As IGrooveFormsToolUIDelegate


Returns the IGrooveFormsToolUIDelegateobject, which provides access to the Groove runtime environment and to Groove services. For example, you can use it to find the members of the workspace, send instant messages, and open transactions to lock the workspace while you are accessing a record. In macros, this function is not available the object is provided by the i_FormsToolUIDelegate parameter.

GetAttachmentCount

GetAttachmentCount() As Number
Returns the number of attachments in the current form. If the current field does not have an attachment field, this function returns null.

GetContactFieldValue

GetContactFieldValue(i_FieldName) As IGrooveFormsToolContact


Returns the contact object assigned to the specified form field. If the field has a type other than Contact, this function causes an error. If the field has not been set to a Contact, this function returns Null.

GetFormID

GetFormID() As Number
Returns the ID of the current form.

GetFormRecord

GetFormRecord() As IGrooveFormsToolRecord


Return the current record as an IGrooveFormsToolRecord object.

GetHTMLFieldValue

GetHTMLFieldValue(i_FieldName) As String


Returns the current value of any HTML field on the form as a string. It does not work on Rich Text or Attachments fields. Note that GetHTMLFieldValue("PhoneNumber") is equivalent to document.GrooveFormBase.PhoneNumber.value. You should not call this function on a field with a Date Time type, but should use GetHTMLFieldValueAsDate instead. If you call GetHTMLFieldValue on a field with a Date Time type, it returns the string that specifies the date but does not include the time value.

GetHTMLFieldValueAsDate

GetHTMLFieldValueAsDate(i_FieldName) As Number


Returns the current value of any Date or Date Time HTML field on the form as a number. This function provides the value for fields with types Date and Date Time. If you call this function for a field with any other type, the return value has no meaning.

GetHTMLFieldValueAsNumber

GetHTMLFieldValueAsNumber(i_FieldName) As Number


Returns the current value of any numeric HTML field on the form as a string. This function provides the value for fields with types Number, Unformatted Number, and Currency. If you call this function for a field with any other type, the return value has no meaning.

GetIsFormPreview

GetIsFormPreview() As Boolean


Returns TRUE if the form is open in preview layout of the Forms Designer and FALSE otherwise. Note that if the form is opened in the user data preview pane, this function returns FALSE and GetIsPreviewPane returns TRUE. In macros, this function has no meaning.

GetIsNew

GetIsNew() As Boolean


Returns TRUE if record is new and has not yet been stored, FALSE otherwise. In macros, this function has no meaning.

GetIsPreviewPane

GetIsPreviewPane() As Boolean


Returns TRUE if form is opened in preview pane and FALSE otherwise. In macros, this function has no meaning.

GetIsReadOnly

GetIsReadOnly() As Boolean

Returns TRUE if the record is read-only -- that is the current user cannot update the record -- and FALSE otherwise.

GetIsResponse

GetIsResponse() As Boolean


Returns TRUE if record is a response; FALSE otherwise.

GetIsSearch

GetIsSearch() As Boolean

Returns TRUE if form opened in search dialog and FALSE otherwise. In macros, this function has no meaning.

GetIsVersioned

GetIsVersioned() As Boolean

Returns TRUE if records are versioned for the current form; FALSE otherwise. If records are versioned for the current form, then when the user updates a record, the previous values are stored in a new record created as a child of the updated record.

GetRecordID

GetRecordID() As Number

Returns the ID of the current record.

GetSelectedID

GetSelectedID() As Number

Returns the ID of the record selected in the view when the user is adding a record. If the record is a response, the selected record will be the parent of the newly created record. If the user is not adding a new record, this function returns -1.

HasValidationErrors

HasValidationErrors() As Boolean

Returns TRUE if the last call to SaveCurrentFormData failed because there were validation errors, and returns FALSE if the last call to SaveCurrentFormData succeeded.

HideField

HideField(i_FieldName)

Hides a field. For compatibility with previous versions, this function takes an optional second parameter, i_bHide (which is not shown in the function syntax). If i_bHide is specified and has a FALSE value, this function is equivalent to ShowField(i_FieldName).

InsertBSTREnumIntoListField

InsertBSTREnumIntoListField(i_BSTREnum, i_FieldName, i_bAllowDuplicates)

Inserts string values from an IGrooveBSTREnum into a drop-down or listbox field. By default, it does not add a string value if it duplicates a value in the drop-down or listbox field. If you specify the optional parameter i_bAllowDuplicates as TRUE, the function skips the test for duplicates and adds all string values in the enumeration to the drop-down or listbox field. By using the results of a lookup as the i_BSTREnum value, you can easily add the results of a lookup to a drop-down or listbox field.

IsValidDate

IsValidDate(i_Value) As Boolean

Tests if a numeric value is a valid date field. The Forms tool stores date values as an integer in milliseconds from January 1, 1970. If the user leaves a date value unassigned, the Forms tool stores a large negative number in the record to indicate that the date value is unspecified. If you attempt to display this as a date value, you will get a meaningless date value. Consequently, you should test values read from date fields in records with this function before displaying the date or converting it to a text string. Returns TRUE if the date is valid; returns FALSE if the numeric value is the large negative number used to indicate unspecified dates. This function can be called from macros as well as scripts.

LoadAddAttachmentDialog

LoadAddAttachmentDialog()

If the current form has an attachment field, this function displays the add attachment dialog to allow the user to select and add an attachment to the form. This function displays a modal dialog and should not be called from a script when a transaction is open. Note that macros are executed within an open transaction so this function should not be called from a macro.

OpenThisRecord

OpenThisRecord()

Opens the current record for edit in full-screen mode from the preview pane. Typically this function is executed from an OnClick function. It should be the last statement in the function since the remaining statements are not executed. If this function is executed and the record is not currently being displayed in the preview pane, then the function has no effect. If the current user does not have privileges to edit the current record, the record is opened for read access only.

RefreshErrorIcons

RefreshErrorIcons()

Refreshes the location of error icons on the form. These error icons are displayed whenever the user enters data that does not pass validation. If a script dynamically relocates fields on a form, it should call this function to ensure that any error icons are displayed at the correct location.

RefreshPreviewPane

RefreshPreviewPane()

Refreshes the preview pane. Scripts should call this function when they are running on a form displayed in the preview pane and they have altered the contents of the form. The GetIsPreviewPane indicates whether the form is being displayed in the preview pane. This function has no effect if it is called when the form is not being displayed in the preview pane.

SetContactFieldValue

SetContactFieldValue(i_FieldName, i_Contact)

Sets the specified form field to the specified contact. If the field has a type other than Contact, this function causes an error. If i_Contact has a null value, the existing contact is removed from the field.

SetFieldLabel

SetFieldLabel(i_FieldName, i_Label)

Sets the display label on the form to the string specified by the i_Label parameter. In macros there is no form; consequently, this function is not available.

SetHTMLFieldValue

SetHTMLFieldValue(i_FieldName, i_Value)

Sets the value of any HTML field on the form to the specified string. It does not work on Rich Text or Attachments fields. You should not call this function on a field with a type of Date Time but should use SetHTMLFieldValueAsDate instead. Note that SetHTMLFieldValue("PhoneNumber", "999-888-7777") is equivalent to document.GrooveFormBase.PhoneNumber.value= "999-888-7777".

SetHTMLFieldValueAsDate

SetHTMLFieldValueAsDate(i_FieldName, i_Value)

Sets the value of a Date or Date Time HTML field on the form to the specified numeric date value. It only sets the value of the field if the field type is Date or Date Time.

SetHTMLFieldValueAsNumber

SetHTMLFieldValueAsNumber(i_FieldName, i_Value)

Sets the value of any numeric HTML field on the form to the specified numeric value. It only sets the value of the field if the field type is Number, Unformatted Number, or Currency.

ShowField

ShowField(i_FieldName)

Displays a previously hidden field. This function takes an optional second parameter, i_bShow, which is not shown in the function syntax. If i_bShow is specified and has a FALSE value, this function is equivalent to HideField(i_FieldName).

Constants for Enumerated Types

Constant Description

GrooveMessageBoxIcon_None GrooveMessageBoxIcon_Exclamation GrooveMessageBoxIcon_Information

Specifies the icon to be displayed; used in the IGrooveFormsToolUIDelegateDisplayStatusBarMessage method.

GrooveDialogBoxResultCode_OK GrooveDialogBoxResultCode_Cancel

Values returned by the GrooveSimpleDialogResult property.

GrooveFormsToolRole_Guest GrooveFormsToolRole_Participant GrooveFormsToolRole_Manager

Values returned by the GrooveFormsToolUIDelegateCurrentRole property.

GrooveIntlDateFormatStyle_Long GrooveIntlDateFormatStyle_Short

Date formats used by the GrooveFormsToolUIDelegateFormatDate, FormatDateTime, ParseDate, and ParseDateTime methods.

GrooveFormsToolLinkType_None GrooveFormsToolLinkType_Record GrooveFormsToolLinkType_View GrooveFormsToolLinkType_Tool

Specifies the kind of link to create in the IGrooveFormsToolLinkObjectLinkType.

See Also

Concepts

Forms Script Examples