warn user that data not be saved

Hi!

How to detect that some data in update form are changed when user click on some link but not Save button?

In case the user changed any of values in Update form and not saved it but clicked to any link that is not Save button, how to warn him/her that data will not be saved before leave the page?

The aim is to point out the user to save data (click on Save button) before use some other link.

do that using javascript, attaching it to all links in the page, checking if its changed

something like:




//some var to check if any content has changed

var changed=false;

//bind some event to check if content has changed

$('input').change(function(){

	changed=true;

});

//bind the click to links and buttons

$('a,button[type!=submit]').click(function(){

   if(changed)

   	return confirm('Content was changed.\nAre you sure you want to leave the page ?');

});



something like that

There could be a clue here

doodle

Gustavo and got 2 doodle

Thanks a lot. This is solution for my question.

got 2 , thx for solution

nice solution… thanks