Skip to main content
Closed for Voting

Binding onunload event to prevent loss of entered reply text

Related products:Freshdesk
  • May 10, 2012
  • 1 reply
  • 2 views

Support agents would benefit from the following functionality:
Binding onunload event to prevent loss of entered reply text

It is already implemented eg. in Wordpress CMS - when user enter a text into a field, a flag is set that makes the browser ask user for confirmation before leaving the page.

Example code:

var inputChanged = false;
function navigateAway() {
  if(inputChanged) {
    return 'If you leave this page, the text you have entered will be lost.';
  }
}


$(window).bind('beforeunload', navigateAway);
$(document).delegate(':input', 'change', function(e) { inputChanged = true; });
$(document).delegate('a', 'click', function() { inputChanged = false; });
$(document).delegate('form', 'submit', function() { inputChanged = false; });

1 reply

aravind.sundararajan
Skilled Expert
Forum|alt.badge.img+12

Hello,


Freshdesk, by default stores the reply typed on the ticket as drafts and it can be accessed for about 24 hours time. For the notes field, it doesn't store drafts but the user would get an alert message if they try to navigate to a different page with the note window collapsed.


Cheers!