JavaScript Functions

 Show all Hide all

Api.closePopup()

If the current menu item is displayed in a popup then the popup is closed.

If the menu item is not a popup then behavior is undefined.

Always use this function instead of closing the window directly with window.close().

Return value:

N/A

Parameters:

N/A

Api.dropDownSetContentsFromPopup()

dropDownSetContentsFromPopup is used in combination with menuitemPopup. Use menuitemPopup in the "Button (javascript)" field for a dropdown in a newedit or parameter page.

From the popup menu item, create a link to a javascript menu item that calls dropDownSetContentsFromPopup. When the user clicks on the link the popup window will close and the specified information is copied to the dropdown.

The syntax is:
dropDownSetContents(Value, Text);

Text is the text shown in the dropdown, and Value is the value sent to the insertUpdate procedure.

Example:
SELECT 'dropDownSetContents(''' + CONVERT(varchar(30), @id) + ''', ''' + @label + ''');' AS [JavaScript]

Return value:

N/A

Parameters:

@idValue Mandatory string
@text Mandatory string

Api.pasteHtmlFromPopup

From a popup opened by menuitemPopup, pastes HTML into the HTML editor that opened the poupup and then closes the popup.

Return value:

N/A

Parameters:

@html Mandatory string
HTML to paste.

Api.setClipboardText

Copy text to the user's clipboard.

This should only be used in internal systems as the function is browser dependent and the future support is unclear.

This can only be triggered from certain events, for example from onClick.

Return value:

N/A

Parameters:

@text Mandatory string

Api.setFieldValueFromPopup

Set the value of a field opened by menuitemPopup.

When you call menuitemPopup you pass it the name of a field. setFieldValueFromPopup will close the popup and set the value of that field.

setFieldValueFromPopUp is unable to set the value of fields in multirows.

Return value:

N/A

Parameters:

N/A

Api.setHtmlFromPopup

From a popup opened by menuitemPopup, overwrites the HTML in the HTML editor that opened the poupup and then closes the popup.

Return value:

N/A

Parameters:

@html Mandatory string
HTML to use.

dropDownSetContents

Legacy-alias for Api.dropDownSetContentsFromPopup. The alias can only be called from grid-menu items.

Return value:

N/A

Parameters:

N/A

getFieldValue

Used to get the value of a particular control at a 'newedit-page'

Return value:

string

Parameters:

N/A

isFieldVisible

Used in settingfield "visibility javascript" to control the visibility of a menufield.

Return value:

string

Parameters:

@fieldName Mandatory string

menuitemPopup

Used to open a popup window from a button in a NewEdit. A passing field "IsPopup" will be available for menu items opened in a popup.

menuitemPopup should not be called from a field in a multirow.

Return value:

N/A

Parameters:

@MenuitemId Mandatory integer
@InputName Optional string
Name of the control to set the value for.
@PassingFields Optional string

multirowAppendRows

Imports rows into a multirow without removing existing rows.

An import is performed by calling the MultiRow stored procedure with @Action set to 'load'. The parameters importType and importId is also supplied to the stored procedure.

Unique constraint violations between the new rows and existing rows will be merged.

Return value:

N/A

Parameters:

@fieldName Mandatory string
Name of the multirow control
@importType Mandatory string
Type of import to perform. This is passed to the stored procedure in the @ImportType parameter.
@importId Mandatory integer
Id of the object to import from. This value is passed as the @ImportID parameter to the stored procedure.

multirowClearAllRows

Clears all rows from a multirow.

Return value:

N/A

Parameters:

@fieldName Mandatory string
Name of the multirow control.

multirowSetRows

Imports rows into a multirow replacing the existing rows.

An import is performed by calling the MultiRow stored procedure with @Action set to 'load'. The parameters importType and importId is also supplied to the stored procedure.

Return value:

N/A

Parameters:

@fieldName Mandatory string
Name of the multirow control
@importType Mandatory string
Type of import to perform. This is passed to the stored procedure in the @ImportType parameter.
@importId Mandatory integer
Id of the object to import from. This value is passed as the @ImportID parameter to the stored procedure.

setFieldFocus

Used to set focus on a particular control at a 'newedit-page'

Return value:

N/A

Parameters:

@fieldName Mandatory string

setFieldValue

Used to set the value of a particular control at a 'newedit-page'

Return value:

N/A

Parameters:

@fieldToEdit Mandatory string
Name of the field to edit
@data Mandatory string
Data to insert into the referenced field.

setFieldValuesFromWebService

Executes a web service call-menu item and uses the columns returned from its @Action='finished' call to set the values of input fields whose names match the column names.

Only available to button javascripts.

Return value:

N/A

Parameters:

@menuItemId Mandatory integer
Menu item to call. This menu item must use the web service call component.
@passingfields Optional string
Fields to pass to the menu item. Formatted as standard query string.

Example: 'ssno={ssno}&task=getinfo'

submitForm

Used to submit a parameter page or NewEdit.

Calling this function from a parameter page is equivalent to clicking on the "Search button".

Calling this function from a NewEdit is equivalent to pressing ctrl+s.

The behavior is undefined when used on a multipart with more than one NewEdit / parameter page.

Return value:

N/A

Parameters:

N/A