This section describes JavaScript functions and objects included with Oracle Application Express and available on every page. You can use these functions and objects to provide client-side functionality, such as showing and hiding page elements, or making XML HTTP Asynchronous JavaScript and XML (AJAX) requests.
Topics:
Given a jQuery selector, jQuery object or DOM Node the specified pEvent will be triggered. pEvent can be a browser event like "click" or "change" but also a custom event like "slidechange". This function should only be used to trigger events that are handled by the dynamic action framework. Otherwise, custom events registered by plug-ins installed in your application or any event that is already exposed in dynamic actions can be compromised.
Boolean
pSelector (jQuery selector | jQuery object | DOM Node) pEvent (String) pData (Object)
Given a page item name different options can be registered for a page item with the Application Express JavaScript framework. This is necessary to seamlessly integrate a plug-in item type with the built-in page item related JavaScript functions of Application Express.
pName (string) pOptions (Object)
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.
(DOM Node | false)
pNd (DOM Node | string ID)
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.
pNd (DOM Node | string ID)
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 will be returned, otherwise a string.
(string|array)
pNd (DOM Node | string ID)
Given a DOM node or string ID (pNd), this function sets the Application Express item value taking into account what type of item it is. 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 will be used to set the "Input Field". The value of pValue will be stored in the hidden return field.
pNd (DOM Node | string ID) pValue (String | Array) pDisplayValue(String)
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.
pNd (DOM Node | string ID | Array)
Array
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 will be returned otherwise the array will be returned. Used for creating DOM based functionality that can accept a single or multiple DOM nodes.
Array (DOM Node | string ID | Array)
Array or first value
If pTest
is empty or false return pDefault
otherwise return pTest
.
(string | Array)
pTest (String | Array) pDefault (String | Array)
This function submits the page using the options sepcified in pOptions
.
pOptions (Object) where Object can contain the following options: request - The request value to set (defaults to null) set - Object conatining name/value pairs of items to be set on the page prior to submission(defaults to null). showWait - Flag to control if a 'Wait Indicator' icon is displayed, which can be useful when running long page operations (Defaults to false).
This example submits the page with a REQUEST value of 'DELETE' and 2 page item values are set, P1_DEPTNO
to 10
and P1_EMPNO
to 5433
. During submit a wait icon is displayed as visual indicator for the user as well.
apex.submit({ request:"DELETE", set:{"P1_DEPTNO":10, "P1_EMPNO":5433}, showWait:true});
This function submits the page setting the Application Express Request value pRequest
.
pRequest (String)
Submits the current page with a REQUEST value of 'DELETE'.
apex.submit({ request:"DELETE", set:{"P1_DEPTNO":10, "P1_EMPNO":5433});
Displays a confirmation showing a message (pMessage
) and depending on user's choice, submits a page setting request value (pRequest
) or cancels page submit.
pMessage (string) pRequest (string)
This example shows a confirmation dialog with the text 'Delete Department'. If the user chooses to proceed with the delete, the current page is submitted with a REQUEST value of 'DELETE'
apex.confirm('Delete Department', 'DELETE');
Displays a confirmation showing a message (pMessage
) and depending on user's choice, submits a page setting request values specified by (pOptions
) or cancels page submit.
pMessage (string) pOptions (object) Object can contain the following options: request - The request value to be set (Defaults to null) set - Object containing name / value pairs of items to be set on the page prior to submission (Defaults to null)
This example shows a confirmation message with the 'Save Department?' text. If the user chooses to proceed with the save, the page is submitted with a REQUEST
value of 'SAVE' and 2 page item values are set, P1_DEPTNO
to 10
and P1_EMPNO
to 5433
."
apex.confirm("Save Department?", { request:"SAVE", set:{"P1_DEPTNO":10, "P1_EMPNO":5433});
This example submits the current page and sets the REQUEST
value to SAVE
.
apex.submit('SAVE');
Sets a specific style property (pStyle
) to given value (pString
) of a DOM node or DOM node Array (pNd
).
(DOM node | DOM Array)
pNd (DOM node | string ID | DOM node Array ) pStyle (String) pString (String)
Hides a DOM node or array of DOM nodes (pNd
). This will also take into consideration which type of Application Express item is being hidden.
(DOM node | Array)
pNd (DOM node | string ID | DOM node Array )
Shows a DOM node or array of DOM nodes (pNd
). This will also take into consideration which type of Application Express item is being hidden.
(DOM node | Array)
pNd (DOM node | string ID | DOM node Array )
Toggles a DOM node or array of DOM nodes (pNd).
(DOM node | Array)
pNd (DOM node | string ID | Array)
Removes a DOM node or array of DOM nodes.
(DOM Node | Array)
pNd (DOM node | string ID | DOM node Array)
Sets the value (pValue
) of a DOM node or array of DOM nodes (pNd
).
Not applicable.
pNd (DOM node | string ID | DOM node Array) pValue (String)
Starting from a DOM node (pNd
), this function cascades up the DOM tree until the tag of node name (pToTag
) is found.
(DOM Node | false)
pNd (DOM Node | string ID) String (pToTag) String (pToClass )
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.
Not applicable.
pNd (DOM Node | string ID | Dom node Array) pFunc ['TOGGLE','SHOW','HIDE'] (String )
Given a page item name, this function hides the entire row that holds the item. In most cases, this will be the item and its label.
Not applicable.
pNd (DOM Node | string ID | DON node Array)
Given a page item name, this function shows the entire row that holds the item. In most cases, this will be the item and its label.
Not applicable.
pNd (DOM node | string ID | DOM note Array)
Given a page item name (pNd), this function toggles the entire row that holds the item. In most cases, this will be the item and its label.
Not applicable.
pNd (DOM node | string ID | DOM node ray)
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
.
(DOM node | DOM Array)
pNd (DOM node | string ID | DOM node Array) pNdArray (DOM node | String | Array)
Hides all sibling nodes of given pNd
.
(DOM node)
pNd (DOM node | string ID )
Shows all sibling DOM nodes of given DOM nodes (pNd
).
(DOM node)
pNd (DOM node | string ID )
Sets a DOM node or array of DOM nodes to a single class name.
Not applicable.
pNd (DOM node | string ID | DOM node Array) pClass (String)
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
.
(DOM node | false)
pNd (DOM Nnde | string ID) pClass (String) pThisClass (String)
Returns an array of DOM nodes by a given class name (pClass
). If the pNd
parameter is provided, then the returned elements will be all be children of that DOM node. Including the pTag
parameter further narrows the list to just return nodes of that tag type.
(Array)
pClass (String) pNd (DOM node | string ID) pTag (String)
Show all the DOM node children of a DOM node (pNd
) that have a specific class (pClass
) and tag (pTag
).
Not applicable.
pNd (DOM node | string ID) pClass (String) pTag (String)
Show all DOM node children of a DOM node (pNd
).
Not applicable.
pNd (DOM node | string ID)
Hide all DOM node children of a DOM node (pNd
).
Not applicable.
pNd (DOM node | string ID)
Disables or enables an item or array of items based on (pTest
).
Not applicable.
pNd (DOM node | string ID | DOM node array) a (true | false)
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
.
false, Array Array of all items that are empty (false | Array)
pNd (DOM node | string ID | DOM node Array) Sting (pClassFail) Sting (pClass)
Returns an item value as an array. Useful for multiselects and checkboxes.
(Array)
pId (DOM Node | string ID)
Returns an item value as an array. Useful for radio items and check boxes.
(Array)
pId (DOM node | string ID)
Clears the content of an DOM node or array of DOM nodes and hides them.
Not applicable.
pNd (DOM node | string ID | DOM node array)
Returns the DOM nodes of the selected options of a select item (pNd
).
(DOM Array)
pNd (DOM node | string ID)
Returns the values of the selected options of a select item (pNd
).
(DOM Array | String)
pNd (DOM node | string ID)
Given an array (pArray
) return a string with the values of the array delimited with a given delimiter character (pDelim
).
Not applicable.
pArray (pArray) pDelim (String)
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.
(true | false)
pId (DOM Node | String) pSearch (pSearch)
Checks an page item's (pThis
) value against a set of values (pValue
). This function returns true if any value matches.
(true | false)
pThis (DOM node | string ID) pValue (Number | String | Array)
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.
(true | false)
pThis (DOM node | string ID) pThat (DOM node | string ID | DOM node Array ) pValue (Number | String | Array)
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.
(true | false)
pThis (DOM node | string ID) pThat (DOM node | string ID | DOM node Array ) pValue (Number | String | Array)
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.
(true | false)
pThis (DOM node | string ID) pThat (DOM node | string ID | DOM node Array ) pValue (Number | String | Array)
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.
(true | false)
pThis (DOM node | string ID) pThat (DOM node | string ID | DOM node Array ) pValue (Number | String | Array)
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.
(true | false)
pThis (DOM node | string ID) pValue (String) pThat (DOM node | string ID | DOM node Array )
Sets a class attribute of an array of nodes that are selected by class.
(DOM node | DOM node Array)
pNd (DOM node | string ID) pClass (String) pTag (String) pClass2 (String)
Collects the values of form items contained within DOM node (pThis
) of class attribute (pClass
) and nodeName (pTag
) and returns an array.
No applicable.
pThis (DOM node | string ID) pCLass (String) pTag (String)
Returns all form input items contained in a DOM node (pThis
) of a certain type (pType
).
DOM node Array
pNd (DOM node | string ID) pType (String)
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.
Not applicable.
pThis (DOM node | string ID) pCheck (true | fales) pArray (DOM node array)
This function sets all checkboxes located in the first column of a table based on the checked state of the calling checkbox (pNd
), useful for tabular forms.
DOM node Array
pNd (DOM node | String)
Sets the value of the item in the parent window (pThat
), with (pValue
) and then closes the popup window.
Not applicable.
pValue (string) pThat (DOM node | string ID)
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
) will be rewritten. The image src will have any plus substrings replaced with minus substrings or minus substrings will be replaced with plus substrings.
(DOM Node)
pThis (DOM Node | string ID) pNd (DOM Nnde | string iD | DOM node Array)
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
).
(DOM node | false)
pNd (DOM node | string ID) pSearch (String) pReplace (String)
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.
(true | fales)
pNd (DOM node | string ID) pSearch (String)
Returns a true or false if a string (pText
) contains a substring (pMatch
).
(true | false)
pText (String) pMatch (String)
Use DOM methods to remove all DOM children of DOM node (pND
).
Not applicable.
pNd (DOM node | string ID)
Returns true or false if a form element is empty, this will consider any whitespace including a space, a tab, a form-feed, as empty. This will also consider any null value that has been specified on the item.
[true | false]
pThis (DOM Node | String)
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).
Not applicable.
pId (DOM node | String) pValue (String)
Adds an onload function (func
) without overwriting any previously specified onload functions.
Not applicable.
pFunction (Javascript Function)
Swaps the form values of two form elements (pThis
,pThat
).
Not applicable.
pThis (DOM Node | String) pThat (DOM Node | String)
Submits a page when ENTER is pressed in a text field, setting the request value to the ID of a DOM node (pNd
).
Usage is onkeypress="submitEnter(this,event)"
Not applicable.
pNd (DOM node | String | Array)
Sets array of form item (pArray
) to sequential number in multiples of (pMultiple
).
Not applicable.
pArray (Array) pMultiple (Number)
Inserts the html element (pTag
) as a child node of a DOM node (pThis
) with the innerHTML set to (pText
).
DOM node
pThis (DOM node | string ID ) pTag (String) pText (String)
Appends a table cell to a table row (pThis
). And sets the content to (pText
).
(DOM node)
pThis (DOM node | string ID) pText (String)
Appends a table cell to a table row (pThis
). And sets the content to (pText
).
DOM node
pThis (DOM node | string ID) pTest (String)
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
.
(DOM node)
pThis (DOM node | string ID) pType (String) pId (String) pName (String) pValue (String)
Takes a DOM node (p_Node
) and makes it a child of DOM node (p_Parent
) and then returns the DOM node (pNode).
(DOM node)
p_This (DOM node | string ID) p_Parent (DOM node | string ID)
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
.
Not applicable.
pThis (DOM node | String) pColor(String)
Give an table row Dom node (pThis
), this function sets the background of all table cells to NULL
.
Not applicable.
pThis (DOM Element | String)
Sets the value of a form item (pNd) to uppercase.
Not applicable.
pNd (DOM Node | String)
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 will be set to a block level element when set to visible.
Not applicable.
pThis (DOM node | String) pString (String) pTags (String pClass (String)
Sets DOM node in the global variables returnInput (p_R)
and returnDisplay (p_D)
for use in populating items from popups.
Not applicable.
p_R (DOM node | String) p_R (DOM node | String)
Sets DOM items in the global variables returnInput
(p_R
) and returnDisplay
(p_D
) for use in populating items from popups.
Not applicable.
p_R p_D
Places the user focus on the a form item (pNd). If pNd is not found then this function places focus on the first found user editable field.
true (if successful)
pNd
Returns the value of cookie name (pName
).
Not applicable.
pName (String)