Field-by-field confirmation popup

Hi, I've searched and can't find a straightforward answer to my
particular need. There are actually two related situations I need to
find solutions for.

1. On a data entry form, for certain fields I want to do some
validation right after the user leaves the field (rather than wait
until the entire form is completed). If invalid, I want a modal
window to pop up with my composed message in it and an OK button.
When the user presses OK, control returns to the data entry form
remaining in the problem field.

I'd be very annoyed if I were lambasted by a modal dialog each time each
time I haven't filled-in a field correctly. Of course, I want to be
notified that there's something wrong with the field, but I'd much
prefer a more unobtrusive way.

That said, have a look at the recent thread with subject "Java script

2. On a data entry form where an existing record is being updated, if
the user changes a non-empty field to different value in any field
(with a few exceptions), I want a modal window to pop up with a
confirmation message and OK and Cancel buttons. When the user presses
OK, control continues normally to the next field on the form. When
Cancel, the user's change will be reversed (restoring the previous
value to the field) and control remains in the problem field.

Here, too, I'd recommend a less obtrusive approach. Mark changed fields
in some way or show the old values next to the current ones.

Once upon a time, I've written a small script that does the marking.

Please don't take this script as is, only as a source for ideas. Also,
have a look at the validator script in the plugin I refer to in the
thread mentioned above.