Nathan Wouldn't it make more sense to place a confirmation on the cancel button? Rather than checking all of the data against the original, then asking the user whether it was really what they wanted to do if it's different, then saving/discarding it based on their response?
As an aside, if users are clicking cancel by mistake, you may also want to take a look at your UI - the controls should be clear enough that submit/cancel are distinct and difficult to confuse with one another. Gabriel. -----Original Message----- From: Nathan Chen [mailto:nathan.c...@cu.edu] Sent: Saturday, 27 June 2009 5:28 AM To: cf-talk Subject: RE: Detect data change in cfform Maybe I wasn't clear. Sometimes users would make some changes and then click the cancel button by mistake and find out they lose the changes. I need a routine that detects if data have been altered. Nathan -----Original Message----- From: Dave Watts [mailto:dwa...@figleaf.com] Sent: Friday, June 26, 2009 11:09 AM To: cf-talk Subject: Re: Detect data change in cfform > I am building a form that allows users to edit data retrieved from > multiple tables. There are many fields in the form. If the users don't > change anything and hit the cancel button, then I don't need to do the > update, otherwise several sql update statements will be executed. Is > there an easy way to detect if users have made changes to the data in > cfform rather than comparing each field to the original data? Not really, but why would your cancel button submit the form? Simply have it do something else, like redirect the user to the previous screen. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ Fig Leaf Software provides the highest caliber vendor-authorized instruction at our training centers in Washington DC, Atlanta, Chicago, Baltimore, Northern Virginia, or on-site at your location. Visit http://training.figleaf.com/ for more information! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324036 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4