From 217459424ff9850fc345f2078d081bb9c9566d91 Mon Sep 17 00:00:00 2001 From: minhaz Date: Fri, 18 Apr 2014 17:33:43 +0530 Subject: [PATCH 1/2] Confirm message for Confirm Navigation Signed-off-by: A V Minhaz --- js/messages.php | 1 + 1 file changed, 1 insertion(+) diff --git a/js/messages.php b/js/messages.php index bc9e1ada48..de12846715 100644 --- a/js/messages.php +++ b/js/messages.php @@ -43,6 +43,7 @@ $js_messages['strDroppingPrimaryKeyIndex'] = __('Dropping Primary Key/Index'); $js_messages['strOperationTakesLongTime'] = __('This operation could take a long time. Proceed anyway?'); $js_messages['strDropUserGroupWarning'] = __('Do you really want to delete user group "%s"?'); $js_messages['strConfirmDeleteQBESearch'] = __('Do you really want to delete the search "%s"?'); +$js_messages['strConfirmNavigation'] = __('Are you sure you want to navigate away from this page? Press OK to continue or Cancel to stay on the current page.'); /* For indexes */ $js_messages['strFormEmpty'] = __('Missing value in the form!'); From e5f0b0881cdec9f446b64211972174c8288c52d7 Mon Sep 17 00:00:00 2001 From: minhaz Date: Fri, 18 Apr 2014 17:39:04 +0530 Subject: [PATCH 2/2] patch for feature request #1518 Signed-off-by: A V Minhaz --- js/ajax.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/js/ajax.js b/js/ajax.js index 41043f559e..b8cb7a7f54 100644 --- a/js/ajax.js +++ b/js/ajax.js @@ -160,6 +160,20 @@ var AJAX = { event.preventDefault(); event.stopImmediatePropagation(); } + + //sometime we accidently click on a url,refresh button or back button + //operation to confirm if user want to leave page in such cases + var flag = false; + $("input[type='text']").each(function(index){ + if($(this).val().length > 0) { + flag = true; + } + }); + //trigger confirm dialog + if (event.type === 'click' && flag && confirm(PMA_messages['strConfirmNavigation']) === false) { + return false; + } + if (AJAX.active === true) { // Cancel the old request if abortable, when the user requests // something else. Otherwise silently bail out, as there is already