Something like this?
form=SQLFORM(db.table,record_id)
if form.process(dbio=False).accepted:
if any(v!=form.record[k] for k,v in form.vars.iteritems()):
record_has_changed
else:
record_has_NOT_changed
On Sunday, 9 December 2012 10:51:14 UTC-6, Joe Barnhart wrote:
>
>
> I've been investigating the use of the DAL feature
> "detect_record_change=True". Apparently it was conceived as a way of
> detecting when the record in the database has changed since the form was
> originally built and populated. My need is for a way to detect when the
> USER has changed fields in the record between the time it was built and
> some other event, such as when the user tries to navigate away from the
> form without pressing the "submit" button.
>
> It seems to me the idea is quite similar -- I want to serialize the data
> in the form and then compare that hash to the same form later. Only
> instead of comparing the data in the database to the hash I want to compare
> the form's version of the data again. Has anyone already done this? Is
> there a better way to detect when a form has actually been changed instead
> of just viewed?
>
> -- Joe B.
>
--