Non-namespace JavaScript APIs

All the miscellaneous, non-namespace APIs of Oracle Application Express, including shortcuts to highly used functions are discussed in the following:

$x

Given a DOM node or string ID (pNd), this function returns a DOM node if the element is on the page, or returns false if it is not.

Parameters

pNd (DOM Node | string ID)

Returns

(DOM Node | false)

$v

Given a DOM node or string ID (pNd), this function returns the value of an Application Express item in the same format as it would be posted.

Parameters

pNd (DOM Node | string ID)

$v2

Given a DOM node or string ID (pNd), this function returns the value of an Application Express item as a string or an array. If the page item type can contain multiple values like a shuttle, checkboxes or a multi select list an array is returned, otherwise a string.

Parameters

pNd (DOM Node | string ID)

Returns

(string|array)

$s

Given a DOM node or string ID (pNd), this function sets the Application Express item value taking into account the item type. The pDisplayValue is optional. If used for a page item of type Popup LOV where the attribute "Input Field" = "Not Enterable, Show Display Value and Store Return Value", it sets the "Input Field". The value of pValue is stored in the hidden return field. The pSuppressChangeEvent parameter is optional. Passing either false or not passing this parameter value results in a change event firing for the item being set. Pass true to prevent the change event from firing for the item being set.

Parameters

pNd (DOM Node | string ID)
pValue  (String | Array)
pDisplayValue(String)
pSuppressChangeEvent(Boolean)

$u_Narray

Given a DOM node or string ID or an array (pNd), this function returns a single value, if an pNd is an array but only has one element the value of that element is returned otherwise the array is returned. Used for creating DOM based functionality that can accept a single or multiple DOM nodes.

Parameters

Array or first value

Returns

Array (DOM Node | string ID | Array)

$u_Carray

Given a DOM node or string ID or an array (pNd), this function returns an array. Used for creating DOM based functionality that can accept a single or multiple DOM nodes.

Parameters

Array

Returns

pNd (DOM Node | string ID | Array)

$nvl

If pTest is empty or false return pDefault otherwise return pTest.

Parameters

pTest  (String | Array)
pDefault (String | Array)

Returns

(string | Array)

$x_Style

Sets a specific style property (pStyle) to given value (pString) of a DOM node or DOM node Array (pNd).

Parameters

pNd (DOM node | string ID | DOM node Array )
pStyle (String)
pString (String)

Returns

(DOM node | DOM Array)

$x_Hide

Hides a DOM node or array of DOM nodes (pNd). This also takes into consideration which type of Application Express item is being hidden.

Parameters

pNd (DOM node | string ID | DOM node Array )

Returns

(DOM node | Array)

$x_Show

Shows a DOM node or array of DOM nodes (pNd). This also takes into consideration which type of Application Express item is being hidden.

Parameters

pNd (DOM node | string ID | DOM node Array )

Returns

(DOM node | Array)

$x_Toggle

Toggles a DOM node or array of DOM nodes (pNd).

Parameters

pNd (DOM node | string ID | Array)

Returns

(DOM node | Array)

$x_Remove

Removes a DOM node or array of DOM nodes.

Parameters

pNd (DOM node | string ID | DOM node Array)

Returns

(DOM Node | Array)

$x_Value

Sets the value (pValue) of a DOM node or array of DOM nodes (pNd).

Parameters

pNd (DOM node | string ID | DOM node Array)
pValue (String)

Returns

Not applicable.

$x_UpTill

Starting from a DOM node (pNd), this function cascades up the DOM tree until the tag of node name (pToTag) is found. If the optional pToClass is present, the ancestor node must have a node name that equals pToTag and the class must equal pToClass.

Parameters

pNd  (DOM Node | string ID) 
String (pToTag) 
String (pToClass )

Returns

(DOM Node | false)

$x_ItemRow

Given DOM node or array of DOM nodes, this function (shows, hides, or toggles) the entire row that contains the DOM node or array of DOM nodes. This is most useful when using Page Items. This function only works in table layouts since it explicitly looks for a containing tr element.

Parameters

pNd (DOM Node | string ID | Dom node Array) 
pFunc ['TOGGLE','SHOW','HIDE'] (String )

Returns

Not applicable.

$x_HideItemRow

Given a page item name, this function hides the entire row that holds the item. In most cases, this is the item and its label. This function only works in table layouts since it explicitly looks for a containing tr element.

Parameters

pNd (DOM Node | string ID | DON node Array)

Returns

Not applicable.

$x_ShowItemRow

Given a page item name, this function shows the entire row that holds the item. In most cases, this is the item and its label. This function only works in table layouts since it explicitly looks for a containing tr element.

Parameters

pNd (DOM node | string ID | DOM note Array)

Returns

Not applicable.

$x_ToggleItemRow

Given a page item name (pNd), this function toggles the entire row that holds the item. In most cases, this is the item and its label. This function only works in table layouts since it explicitly looks for a containing tr element.

Parameters

pNd (DOM node | string ID | DOM node ray)

Returns

Not applicable.

$x_HideAllExcept

Hides all DOM nodes referenced in pNdArray and then shows the DOM node referenced by pNd. This is most useful when pNd is also a node in pNdArray.

Parameters

pNd (DOM node | string ID | DOM node Array) 
pNdArray (DOM node | String | Array)

Returns

(DOM node | DOM Array)

$x_HideSiblings

Hides all sibling nodes of given pNd.

Parameters

pNd (DOM node | string ID )

Returns

(DOM node)

$x_ShowSiblings

Shows all sibling DOM nodes of given DOM nodes (pNd).

Parameters

pNd (DOM node | string ID )

Returns

(DOM node)

$x_Class

Sets a DOM node or array of DOM nodes to a single class name.

Parameters

pNd (DOM node | string ID | DOM node Array)
pClass (String)

Returns

Not applicable.

$x_SetSiblingsClass

Sets the class (pClass) of all DOM node siblings of a node (pNd). If pNdClass is not null the class of pNd is set to pNdClass.

Parameters

pNd (DOM Nnde | string ID)
pClass (String)
pThisClass (String)

Returns

(DOM node | false)

$x_ByClass

Returns an array of DOM nodes by a given class name (pClass). If the pNd parameter is provided, then the returned elements are all children of that DOM node. Including the pTag parameter further narrows the list to just return nodes of that tag type.

Parameters

pClass (String)
pNd  (DOM node | string ID)
pTag (String)

Returns

(Array)

$x_ShowAllByClass

Show all the DOM node children of a DOM node (pNd) that have a specific class (pClass) and tag (pTag).

Parameters

pNd (DOM node | string ID)
pClass (String)
pTag (String)

Returns

Not applicable.

$x_ShowChildren

Show all DOM node children of a DOM node (pNd).

Parameters

pNd (DOM node | string ID)

Returns

Not applicable.

$x_HideChildren

Hide all DOM node children of a DOM node (pNd).

Parameters

pNd (DOM node | string ID)

Returns

Not applicable.

$x_disableItem

Disables or enables an item or array of items based on (pTest).

Parameters

pNd (DOM node | string ID | DOM node array)
a (true | false)

Returns

Not applicable.

$f_get_emptys

Checks an item or an array of items to see if any are empty, set the class of all items that are empty to pClassFail, set the class of all items that are not empty to pClass.

Parameters

pNd (DOM node | string ID | DOM node Array)
Sting (pClassFail)
Sting (pClass)

Returns

false, Array  Array of all items that are empty (false | Array)

$v_Array

Returns an item value as an array. Useful for multiselects and checkboxes.

Parameters

pId (DOM Node | string ID)

Returns

(Array)

$f_ReturnChecked

Returns an item value as an array. Useful for radio items and check boxes.

Parameters

pId (DOM node | string ID)

Returns

(Array)

$d_ClearAndHide

Clears the content of an DOM node or array of DOM nodes and hides them.

Parameters

pNd (DOM node | string ID | DOM node array)

Returns

Not applicable.

$f_SelectedOptions

Returns the DOM nodes of the selected options of a select item (pNd).

Parameters

pNd (DOM node | string ID)

Returns

(DOM Array)

$f_SelectValue

Returns the values of the selected options of a select item (pNd).

Parameters

pNd (DOM node | string ID)

Returns

(DOM Array | String)

$u_ArrayToString

Given an array (pArray) return a string with the values of the array delimited with a given delimiter character (pDelim).

Parameters

pArray (pArray)
pDelim (String)

Returns

Not applicable.

$x_CheckImageSrc

Checks an image (pId) source attribute for a substring (pSearch). The function returns true if a substring (pSearch) is found. It returns false if a substring (pSearch) is not found.

Parameters

pId (DOM Node | String)
pSearch (pSearch)

Returns

(true | false)

$v_CheckValueAgainst

Checks an page item's (pThis) value against a set of values (pValue). This function returns true if any value matches.

Parameters

pThis (DOM node | string ID)
pValue (Number | String | Array)

Returns

(true | false)

$f_Hide_On_Value_Item

Checks page item's (pThis) value against a value (pValue). If it matches, a DOM node (pThat) is set to hidden. If it does not match, then the DOM node (pThat) is set to visible.

Parameters

pThis (DOM node | string ID)
pThat  (DOM node | string ID | DOM node Array )
pValue (Number | String | Array)

Returns

(true | false)

$f_Show_On_Value_Item

Checks page item's (pThis) value against a value (pValue). If it matches, a DOM node (pThat) is set to visible. If it does not match, then the DOM node (pThat) is set to hidden.

Parameters

pThis (DOM node | string ID)
pThat  (DOM node | string ID | DOM node Array )
pValue (Number | String | Array)

Returns

(true | false)

$f_Hide_On_Value_Item_Row

Checks the value (pValue) of an item (pThis). If it matches, this function hides the table row that holds (pThat). If it does not match, then the table row is shown.

Parameters

pThis (DOM node | string ID)
pThat  (DOM node | string ID | DOM node Array )
pValue (Number | String | Array)

Returns

(true | false)

$f_Show_On_Value_Item_Row

Checks the value (pValue) of an item (pThis). If it matches, this function shows the table row that holds (pThat). If it does not match, then the table row is hidden.

Parameters

pThis (DOM node | string ID)
pThat  (DOM node | string ID | DOM node Array )
pValue (Number | String | Array)

Returns

(true | false)

$f_DisableOnValue

Checks the value (pValue) of an item (pThis). If it matches, this function disables the item or array of items (pThat). If it does not match, then the item is enabled.

Parameters

pThis (DOM node | string ID)
pValue (String)
pThat  (DOM node | string ID | DOM node Array )

Returns

(true | false)

$x_ClassByClass

Sets a class attribute of an array of nodes that are selected by class.

Parameters

pNd (DOM node | string ID)
pClass (String)
pTag (String)
pClass2 (String)

Returns

(DOM node | DOM node Array)

$f_ValuesToArray

Collects the values of form items contained within DOM node (pThis) of class attribute (pClass) and nodeName (pTag) and returns an array.

Parameters

pThis (DOM node | string ID)
pCLass (String)
pTag (String)

Returns

Not applicable.

$x_FormItems

Returns all form input items contained in a DOM node (pThis) of a certain type (pType).

Parameters

pNd (DOM node | string ID)
pType (String)

Returns

DOM node Array

$f_CheckAll

Check or uncheck (pCheck) all check boxes contained within a DOM node (pThis). If an array of checkboxes DOM nodes (pArray) is provided, use that array for affected check boxes.

Parameters

pThis (DOM node | string ID)
pCheck (true | fales)
pArray (DOM node array)

Returns

Not applicable.

$f_CheckFirstColumn

This function sets all checkboxes located in the first column of a table based on the checked state of the calling check box (pNd), useful for tabular forms.

Parameters

pNd (DOM node | String)

Returns

DOM node Array

$x_ToggleWithImage

Given an image element (pThis) and a DOM node (pNd), this function toggles the display of the DOM node (pNd). The src attribute of the image element (pThis) is rewritten. The image src has any plus substrings replaced with minus substrings or minus substrings are replaced with plus substrings.

Parameters

pThis (DOM Node | string ID)
pNd (DOM Nnde | string iD | DOM node Array)

Returns

(DOM Node)

$x_SwitchImageSrc

Checks an image (pId) src attribute for a substring (pSearch). If a substring is found, this function replaces the image entire src attribute with (pReplace).

Parameters

pNd (DOM node | string ID)
pSearch (String)
pReplace (String)

Returns

(DOM node | false)

$x_CheckImageSrc

Checks an image (pNd) source attribute for a substring (pSearch). The function returns true if a substring (pSearch) is found. It returns false if a substring (pSearch) is not found.

Parameters

pNd  (DOM node | string ID)
pSearch (String)

Returns

(true | fales)

$u_SubString

Returns a true or false if a string (pText) contains a substring (pMatch).

Parameters

pText (String) 
pMatch (String)

Returns

(true | false)

html_RemoveAllChildren

Use DOM methods to remove all DOM children of DOM node (pND).

Parameters

pNd (DOM node | string ID)

Returns

Not applicable.

html_SetSelectValue

Sets the value (pValue) of a select item (pId). If the value is not found, this functions selects the first option (usually the NULL selection).

Parameters

pId (DOM node | String)
pValue (String)

Returns

Not applicable.

addLoadEvent

Adds an onload function (func) without overwriting any previously specified onload functions.

Parameters

pFunction (Javascript Function)

Returns

Not applicable.

$f_Swap

Swaps the form values of two form elements (pThis,pThat).

Parameters

pThis (DOM Node | String)
pThat (DOM Node | String)

Returns

Not applicable.

$f_SetValueSequence

Sets array of form item (pArray) to sequential number in multiples of (pMultiple).

Parameters

pArray (Array) 
pMultiple (Number)

Returns

Not applicable.

$dom_AddTag

Inserts the html element (pTag) as a child node of a DOM node (pThis) with the innerHTML set to (pText).

Parameters

pThis (DOM node | string ID ) 
pTag (String)
pText (String)

Returns

DOM node

$tr_AddTD

Appends a table cell to a table row (pThis). And sets the content to (pText).

Parameters

pThis (DOM node | string ID)
pText (String)

Returns

(DOM node)

$tr_AddTH

Appends a table cell to a table row (pThis). And sets the content to (pText).

Parameters

pThis (DOM node | string ID)
pTest (String)

Returns

DOM node

$dom_AddInput

Inserts the html form input element (pType) as a child node of a DOM node (pThis) with an id (pId) and name (pName) value set to pValue.

Parameters

pThis (DOM node | string ID)
pType (String)
pId (String)
pName (String)
pValue (String)

Returns

(DOM node)

$dom_MakeParent

Takes a DOM node (p_Node) and makes it a child of DOM node (p_Parent) and then returns the DOM node (pNode).

Parameters

p_This (DOM node | string ID)
p_Parent (DOM node | string ID)

Returns

(DOM node)

$x_RowHighlight

Give an table row DOM element (pThis), this function sets the background of all table cells to a color (pColor). A global variable gCurrentRow is set to pThis.

Parameters

pThis (DOM node | String)
pColor(String)

Returns

Not applicable.

$x_RowHighlightOff

Give an table row Dom node (pThis), this function sets the background of all table cells to NULL.

Parameters

pThis (DOM Element | String)

Returns

Not applicable.

$v_Upper

Sets the value of a form item (pNd) to uppercase.

Parameters

pNd (DOM Node | String)

Returns

Not applicable.

$d_Find

Hides child nodes of a Dom node (pThis) where the child node's inner HTML matches any instance of pString. To narrow the child nodes searched by specifying a tag name (pTag) or a class name (pClass). Note that the child node is set to a block level element when set to visible.

Parameters

pThis (DOM node | String)
pString (String)
pTags (String 
pClass (String)

Returns

Not applicable.

$f_First_field

Places the user focus on a form item (pNd). If pNd is not found then this function places focus on the first found user editable field.

Parameters

pNd

Returns

true (if successful)