util.js

Usage

General-purpose functions.

Location

WEB-OPAL\scripts\util.js

Functions

All Public Functions

addField( form, fieldType, fieldName,

fieldValue, fieldId, addnew)

checkAtleastOneSelected()

checkOnlyOneSelected()

clearForm( formName )

dumpValues( formId, source )
dumpValuesByForm( form )
formatSampleIds( itemsselected )
getAndSetAnySelection( formId )
getAndSetAnySelectionForACB( formId )
getAndSetAtLeastOneSelection( formId )
 
getAndSetAtLeastOneSelectionForACB( formId )
getAndSetSingleSelection( formId )
getAndSetSingleSelectionForACB( formId )
getDefaultLookupWindowOptions()

getPrimaryKeyArray( selectedSDIs, sdiseparator,

fldseparator )

openWindow( url, windowName, width, height,

options, centered )

setKeyidValues( itemsselected, formId )
setKeyidValuesForActionButtons( itemsselected, formId )
 
 

 

 

addField( form, fieldType, fieldName, fieldValue, fieldId, addnew)

Functionality

• Adds input fields to a form.

Parameters

Parameter Description
form Name of the form to which the field is added.
fieldType Field Type.
fieldName Name of the field.
fieldValue Value of the field.
fieldId Field ID.
addnew
false = Sets the value of the field identified by fieldId. If the field does not exist, this function adds the field.
true = Adds the field to the form.

Returns

None.

 

checkAtLeastOneSelected()

Functionality

• Checks if at least one item is selected.

Parameters

None.

Returns

None.

 

checkOnlyOneSelected()

Functionality

• Checks if only one item is selected.

Parameters

None.

Returns

None.

 

checkSelectionNotRequired()

Functionality

• Returns true irrespective of the of the selection.

Parameters

None.

Returns

None.

 

clearForm( formName )

Functionality

• Clears all input elements in the submitdata form.

Parameters

Parameter Description
formName Form object.

Returns

None.

 

dumpValues( formId, source )

Functionality

• Iterates through all input fields in a form and displays them.

Parameters

Parameter Description
formId Form ID. The default is submitdata.
source Source page of the form.

Returns

None.

 

dumpValuesByForm( form )

Functionality

• Iterates through all input fields in a form and displays them.

Parameters

Parameter Description
form Form object.

Returns

None.

 

formatSampleIds( itemsselected )

Functionality

• Formats a %3B-separated list of IDs to a line-separated list.
• Primarily used in alerts to display a list of SDIs.

Parameters

Parameter Description
itemsselected Selected items (use %3B to separate each).

Returns

Return Description
retString Formatted string.

 

getAndSetAnySelection( formId )

Functionality

• Checks if any itmes are selected. If yes, sets keyid1 in the formId, which is passed into the function.

Parameters

Parameter Description
formId ID of the form in which the keys are set. The default is submitdata.

Returns

None.

 

getAndSetAnySelectionForACB( formId )

Functionality

• Checks if any itmes are selected. If yes, sets keyid1 in the formId, which is passed into the function.

Parameters

Parameter Description
formId ID of the form in which the keys are set. The default is submitdata.

Returns

None.

 

getAndSetAtLeastOneSelection( formId )

Functionality

• Checks if at least one item is selected. If yes, sets keyid1 in the formId, which is passed into the function.

Parameters

Parameter Description
formId ID of the form in which the keys are set. The default is submitdata.

Returns

None.

 

getAndSetAtLeastOneSelectionForACB( formId )

Functionality

• Checks if at least one item is selected. If yes, sets keyid1 in the formId, which is passed into the function.

Parameters

Parameter Description
formId ID of the form in which the keys are set. The default is submitdata.

Returns

None.

 

getAndSetSingleSelection( formId )

Functionality

• Checks if only one item is selected. If yes, sets keyid1 in the formId, which is passed into the function.

Parameters

Parameter Description
formId ID of the form in which the keys are set. The default is submitdata.

Returns

None.

 

getAndSetSingleSelectionForACB( formId )

Functionality

• Checks if only one item is selected. If yes, sets keyid1 in the formId, which is passed into the function.

Parameters

Parameter Description
formId ID of the form in which the keys are set. The default is submitdata.

Returns

None.

 

getDefaultLookupWindowOptions()

Functionality

• Returns the default lookup window options.

Parameters

None.

Returns

Return Description
defaultLookupWindowOptions String containing the default lookup window options.

 

getPrimaryKeyArray( selectedSDIs, sdiseparator, fldseparator )

Functionality

• Returns an array consisting of the set of primary keys. The primary keys are passed in as a string.

Parameters

Parameter Description
selectedSDIs String containing SDI keys.
sdiseparator Character separating SDIs. The default is %3B.
fldseparator String containing the field separator (a primary key can have multiple fields). The default is pipe (|).

Returns

Return Description
selectedPrimaryKeyArray Array containing the primary keys. Each primary key is an array containing each field in a different array (actually an "array of arrays"). If no selectedSDIs are specified, this function returns zero length arrays.

 

openWindow( url, windowName, width, height, options, centered )

Functionality

• Opens the window with the specified URL. If the window parameters are not specified, the default window options are used.

Parameters

Parameter Description
url URL of the window to open.
windowName Name of the window to open.
width Width of the window.
height Height of the window.
options Window options.
centered True center-aligns the new window. The default is false.

Returns

Return Description
newWindow New window object.

 

setKeyidValues( itemsselected, formId )

Functionality

• Sets values of keyid1, keyid2, and keyid3 into a form.
  Pass the itemsselected parameter into this function.
  Use %3B to separate SDIs. Use a pipe (|) to separate keys.

Parameters

Parameter Description
itemsselected Selected items.
formId ID of the form in which the keys are set.

Returns

None.

 

setKeyidValuesForActionButtons( itemsselected, formId )

Functionality

• Sets values for action_keyid1, action_keyid2, and action_keyid3 in a form.
• Use %3B to separate SDIs. Use a pipe (|) to separate keys.

Parameters

Parameter Description
itemsselected Selected items.
formId ID of the form in which the keys are set.

Returns

None.