1 person found this helpful
You can use HASH function to calculate hash value from DB and hash value from Input fields. Then you can compare both the hash values to see if something is changed or not.
You can also use hash values to ensure data integrity. i.e. if some other user has updated same record after user has opened the page for editing. In this case, you calculate hash value during page load and store it in hidden item. And while submitting, you can re-calculate hash value from DB and then you can check if it;s been updated by some other user or not.
Thanks Hari. Wouldn't this require generating the hash as an item in the form, generating it again at the time of form submission and then comparing the two? Reckon this would be less efficient that doing a query at form submission time and comparing the values returned by the query with the values for the items in the form. Apex itself has to be doing this internally for the Automatic Row Processing DML process. My thinking was that we might be able to somehow leverage off that.
Yes, I was hoping I could leverage off Apex internal comparison that but not sure how exactly.
do the following
in HTML Form Element Attributes put the following
define myfunct in page header. inside myfunct, you can use apex.submit to set the value of your hidden item.
PS: Kindly mark the reply as helpful/correct if it solves your problem
When you create a form using APEX wizards, then APEX automatically generates check-sum and uses this check-sum to ensure data integrity.
If you see page HTML, you will see hidden item with name 'p_md5_checksum'. This item holds value of check-sum. However since it's not a APEX Page item, you can't directly access it in your code.
Once user clicks on "Submit" or similar button, probably you can read value of this hidden item using JS and then you can update the check-sum value to a APEX HIDDEN PAGE ITEM. This way you can access check-sum value in your code.
And another point is, you need to know which all items APEX is considering to evaluate the check-sum. Only then you can Compute it again and you can verify if something is changed or not.