Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form data changed by user?

Status
Not open for further replies.

hdougl1

Programmer
Dec 6, 2000
54
0
0
US
I would like to know when a user modifies any of the data presented on a web full of data. I have a JavaScript function (window.confirm) to prompt the user "Are you sure you want to close this window? Yes/cancel" when exiting the page whether or not they made any changes.

Instead I would like to maybe compare the form object on the load event against the form object before close, but I don't know if it's possible or how. Any ideas are greatly appreciated.
 
Unless you're writing the changes to a database there's no way that you're going to know if any changes were made. If you are writing to a database then you'll have to do a before and after field to field comparison and write the differences to an audit table. It's a lot of typing but not that difficult to do.
 
You would need to create an onLoad javascript function that stores each of the initial values in a page-level variable (i.e. a variable created outside any function in <HEAD>). Then the confirm function compares their current values with the values stored at load time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top