Reverting changes for invalid rows

Reverting changes for invalid rows

On the form validation I can check the old value of a form row and compare it to the new value. However, I can't find a way to generically revert all changes on a row to their old values. This is what I'm trying, but I can't find the right function for line 9 that corrisponds with the getFieldNames and getFieldValue functions.

  1. found = false;
  2. for each val in input.SubForm {
  3. if(val.ID !=0){
  4. rw = Numbers[ID == val.ID];
  5. for each col in val.getFieldNames()
  6.         {
  7. if(rw.getFieldValue(col) != val.getFieldValue(col)){
  8. found = true;
  9. val.set(col, rw.getFieldValue(col));
  10. }
  11.         }
  12. }
  13. }
  14. if(found){
  15. alert "Some values have been reverted to their original values.";
  16. }