We put in a very simple optimistic locking scheme that works like this:
- every table has a last_update_date
field in it
- when the form is created
the last_update_date for the record
is stored in a hidden input field
- when the form is POSTED the server
checks the last_update_date in the
database against the date in the
hidden input field.
- If they match,
then no one else has changed the
record since the form was created so
the system updates the data.
- If they don't match, then someone else has
changed the record since the form was
created. The system sends the user back to the form edit page and tells the user that someone else edited the record and they must reapply their changes.
It is very simple and works well enough.