Check if any form fields have changed upon saving asp.net c# -
i've got large .net form hundreds of input fields, users navigate off form page without saving, what's best way check if field value has changed when try navigate away? c# function or javascript?
don't take control out of users hand :-)
ask him on exit, if wants save changes. maybe did changes mistake, don't want save.
you can achieve javascript/jquery. like:
$(document).ready(function() { formmodified=0; $('form *').change(function(){ formmodified=1; }); window.onbeforeunload = confirmexit; function confirmexit() { if (formmodified == 1) { return "new information not saved. wish leave page?"; } } $("input[name='commit']").click(function() { formmodified = 0; }); });
Comments
Post a Comment