To stop the user from leaving my page, I'm using this javascript:
window.onbeforeunload = function()
{
if($('textarea#usermessage').val() != '')
{
return "You have started writing a message.";
}
};
This shows a message warning the user not to leave the page because they've started writing a message but not submitted. This shows up to save the user from losing this data.
Now, how can I stop this message from showing up when the form is submitted?