Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jQuery selector for plugin

CashyDec 14 2011 — edited Dec 16 2011
Hi,

I recently posted an article 10032192 where I was having a an issue with users exiting the form before they have saved their changes.

I managed to find a plugin which is working quite well. It is however, firing when all buttons are pressed and not just the 'Progress' (:P3_PROGRESS) button.

I have got the following as a dynamic action which was installed in the plugin:

FUNCTION render_save_before_exit (
p_dynamic_action IN APEX_PLUGIN.T_DYNAMIC_ACTION,
p_plugin IN APEX_PLUGIN.T_PLUGIN
)

RETURN APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT

IS

l_result APEX_PLUGIN.T_DYNAMIC_ACTION_RENDER_RESULT;
l_save_message VARCHAR2(4000);
l_no_warning_sel VARCHAR2(4000);
l_ignore_change_sel VARCHAR2(4000);
l_disable_time PLS_INTEGER;
l_crlf CHAR(2) := CHR(13)||CHR(10);

BEGIN

l_save_message := NVL(p_dynamic_action.attribute_01,'You have made changes to data on this page. If you navigate away from this page without first saving your data, the changes will be lost.');
l_no_warning_sel := NVL(p_dynamic_action.attribute_02,':button');
l_ignore_change_sel := NVL(p_dynamic_action.attribute_03, '#pRequest');
l_disable_time := NVL(p_dynamic_action.attribute_04, 250);

IF apex_application.g_debug
THEN
apex_plugin_util.debug_dynamic_action(
p_plugin => p_plugin,
p_dynamic_action => p_dynamic_action
);
END IF;

apex_javascript.add_library(
p_name => 'apex_save_before_exit.min',
p_directory => p_plugin.file_prefix,
p_version => NULL
);

l_result.javascript_function :=
'function(){apex.jQuery(document).apex_save_before_exit({' || l_crlf
|| ' ' || apex_javascript.add_attribute('saveMessage', l_save_message) || l_crlf
|| ' ' || apex_javascript.add_attribute('noWarningSelector', l_no_warning_sel) || l_crlf
|| ' ' || apex_javascript.add_attribute('disableTime', l_disable_time) || l_crlf
|| ' ' || apex_javascript.add_attribute('ignoreChangeSelector', l_ignore_change_sel, FALSE, FALSE) || l_crlf
|| '});}';

RETURN l_result;

END render_save_before_exit;



In the 'Disable warning selector in the settings of the dynamic action, I have :button (which is defaulted)

Could anyone please point me in the direction of how to go about how to

"Enter a jQuery selector to select elements on the page that should allow a user to leave a page without being prompted to save their changes. Only the text between the parenthesis of a standard jQuery selector should be included. Use a comma separated list for multiple selectors. The default value of ":button" will work for most buttons using themes from APEX 4 or later."

which is the help item of the dynamic action->Settings->disable warning content field?

Thanks
This post has been answered by Cashy on Dec 16 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 13 2012
Added on Dec 14 2011
1 comment
444 views