This namespace is used for all client-side page related functions of Oracle Application Express.
Call to remove the handler that checks for unsaved changes. This is useful to do before any kind of cancel
operation where the user is intentionally choosing to lose the changes. It is not normally necessary to call
this function because the declarative attribute Warn on Unsaved Changes with value Do Not Check will do it
automatically. Adding the class js-ignoreChange
to a link (anchor element)
or button will cause this function to be called before the link or button action.
Example
apex.jQuery( "#custom-cancel-button" ).click( function() {
apex.page.cancelWarnOnUnsavedChanges();
apex.navigation.redirect( someUrl );
} );
Displays a confirmation dialog showing a message, pMessage, and depending on the user's choice, submits the page or cancels submitting. Depending on the value of the page's Reload on Submit attribute, the page is submitted using Ajax or with a normal form submission post request.
Once the user chooses to submit the page, the behavior is the same as for the apex.page.submit function. The shorter alias for this function apex.confirm with the same parameters can also be used.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pMessage |
string |
<optional> |
The confirmation message to display. The default is
"Would you like to perform this delete action?". It is best to supply your own message because the default
message is not localized.
Note: The default message is deprecated. In the future this argument will be required. |
||||||||||||||||||||||||||||||||
pOptions |
string | Object |
<optional> |
If this is a string, it will be used to set the REQUEST value.
If this is null or omitted, the page will be submitted with no REQUEST value.
If this is an object, you can define the following properties:
Properties
|
Examples
apex.page.confirm( "Delete Department", 'DELETE' );
apex.confirm( "Delete Department", 'DELETE' );
apex.page.confirm( "Save Department?", {
request: "SAVE",
set: {
"P1_DEPTNO": 10,
"P1_EMPNO": 5433
}
} );
apex.confirm( "Save Department?", {
request: "SAVE",
set: {
"P1_DEPTNO": 10,
"P1_EMPNO": 5433
}
} );
Return true if any page items or Application Express models on this page have changed since last being
sent to the server. Items that are disabled or are configured to ignore changes are not included in the check.
This will call the pExtraIsChanged
function set in
apex.page.warnOnUnsavedChanges if one was supplied and only if no other changes are found first.
Returns:
- Type
- boolean
Example
if ( apex.page.isChanged() ) {
// do something when the page has changed
}
This function submits the page. The shorter alias for this function apex.submit with the same parameters can also be used. Depending on the value of the page's Reload on Submit attribute, the page is submitted using Ajax or with a normal form submission post request.
This function triggers a apex.event:apexbeforepagesubmit event on the apex.gPageContext$ which can be canceled by an event handler. If canceled, the page is not submitted. Just before the page is submitted, this function triggers a apex.event:apexpagesubmit event on the apex.gPageContext$, which cannot be canceled.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pOptions |
string | Object |
<optional> |
If this is a string, it will be used to set the REQUEST value.
If this is null, the page will be submitted with no REQUEST value.
If this is an object, you can define the following properties:
Properties
|
Returns:
- Type
- boolean | undefined
Examples
apex.page.submit( "DELETE" );
apex.submit( "DELETE" );
apex.page.submit( {
request: "DELETE",
set: {
"P1_DEPTNO": 10,
"P1_EMPNO": 5433
},
showWait: true,
} );
apex.submit( {
request: "DELETE",
set: {
"P1_DEPTNO": 10,
"P1_EMPNO": 5433
},
showWait: true,
} );
apex.jQuery("#P1_TEXT").on( "keydown", function( event ) {
apex.page.submit({
submitIfEnter: event
});
});
Check if any page items or submittable Application Express models on the page are invalid. Any errors are shown inline using the apex.message.showErrors function.
Note: This function does not actually perform any validation. Use HTML 5 validation attributes or API to validate items.
Returns:
- Type
- boolean
Example
apex.jQuery( "#checkButton" ).click( function() {
if ( !apex.page.validate() ) {
alert("Please correct errors");
}
} );
Initialize a handler that checks for unsaved changes anytime the page is about to unload. This is safe to call multiple times. The pMessage and pExtraIsChanged parameters override any previous values. This function is called automatically when the page attribute Warn on Unsaved Changes is set to yes. The main reason to call this manually is to customize the parameters.
See also item#isChanged.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pMessage |
string |
<optional> |
Message to display when there are unsaved changes. If the message is not given,
a default message is used. Note: Most browsers do not show this message. |
pExtraIsChanged |
function |
<optional> |
Optional additional function to be called, checking if there are any unsaved changes. It should return true if there are unsaved changes, and false otherwise. It is only called if there are no changes to any models or page items. This is useful if there are non-standard state-full inputs on the page that are not Application Express items and do not keep their state in an Application Express model. It allows writing a custom function to detect if those non-standard inputs have changed. |
Example
apex.page.warnOnUnsavedChanges( "The employee record has been changed" );