How can I detect changes to data in a HTML form?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   neal_ravindran
Posted On:   Sunday, November 9, 2003 06:01 PM

I have a form with a zillion fields. There are some Add,Edit,Delete buttons on the page which if clicked will take the user to a different page without saving changes already made by the user. So the customer wants to prompt user to save changes before proceeeding to that "add/edit/delete" page...and ONLY if there has been a change...My current script ALWAYS prompts the user with a confirm message(irrespective of whether changes were made to data in form or not) What is the best method of detecting if data in a HTML form has been changed?(once I read somewhere that one could add up all ascii characters onload of page and check if the value of ascii character sum has changed...in onbeforeunload event..I will try that shortly..but if    More>>

I have a form with a zillion fields. There are some Add,Edit,Delete buttons on the page which if clicked will take the user to a different page without saving changes already made by the user. So the customer wants to prompt user to save changes before proceeeding to that "add/edit/delete" page...and ONLY if there has been a change...My current script ALWAYS prompts the user with a confirm message(irrespective of whether changes were made to data in form or not)


What is the best method of detecting if data in a HTML form has been changed?(once I read somewhere that one could add up all ascii characters onload of page and check if the value of ascii character sum has changed...in onbeforeunload event..I will try that shortly..but if there are saner ideas would like to know)

   <<Less

Re: How can I detect changes to data in a HTML form?

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, November 10, 2003 06:24 AM

Perhaps a javascript variable or hidden form field, indicating whether fields have been changed. Start it off false, then in the event handlers for all fields, set it to true?

About | Sitemap | Contact