QUOTE(Christian J @ Apr 17 2009, 06:54 PM)
QUOTE(geoffmerritt @ Apr 17 2009, 05:16 AM)
When the data is changed update the current db and add the entry to the history db
That sounds like my current Undo, that part is no problem. But what to do if the user regrets his latest typing
before he has saved it?
Maybe I could let PHP print an Undo button (really an extra submit button, see above), and then use javascript
onchange to remake it into a Reset button as soon as the user starts typing (so he can no longer Undo the latest save, only reset his typing after that save).
I think this is a terrible idea. The way to make something reliable is for it to be transparent, and a button that does one thing when you look at it, and a different thing when you click it moments later is just asking for confusion.
Look, if the user isn't capable of editing a form, there is no hope for them. I'm filling in a form now, and I find I have an Undo button (it's ctrl-Z) and a back-out-and-start-again button (the browser Back button). Any atempt by you to fake this stuff will be more nuisance than it's worth. (What will happen if I press ctrl-Z?)
As Geoff says, if you want to provide a "Go back to previous version" button, you _must_ show the previous version that is going to be gone back to. And mark it explicitly with something clearer than "Undo".
(Actually looking at your suggestion more carefully it seems even crazier. When I type stuff in a (properly-behaved) form, I know I am only typing on my computer, and not (yet) affecting the system I'm interacting with. But you would disable the "Go back" option the instant I start typing?? So I type something, then think oops, and press ctrl-Z. The form is now back to where it started -- is your javascript going to detect this, and reinstate the "Go back" button????)
I think that if you follow the "philosophy" on which html forms are based, not only does this generally improve usability, but it also saves a huge amount of work.
HTH