Field NOT changed

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered
Form rule check when a field has NOT been changed on Save. Anytime a record has had a field updated, I want to force the user to enter a note regarding this change in the Note field (logged). Simply put, if the record is save and the Note field is NOT changed, it should abort. Any thoughts?
Photo of Steven

Steven

  • 40 Points

Posted 4 years ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 29,924 Points 20k badge 2x thumb
You would have to use script and the image onload technique for this.

For every field control on your form (with name=_fid_n) QuickBase has a hidden <input> (with name=fid_oval_n) that stores the old value of the field. So excluding the logging field itself, when the user presses Save you would run through all the controls comparing the new value with the old value and if changes are detected throw up a dialog that would tell the user to fill in some notes on the logging field.

Now the easiest way to see if there are any changes is to serialize the old and new controls. Searialize just means convert the controls value to a sting and concatenate them all together with ampersands - similar to the format you see in the query strings of URLs.

So this approach would suggest code similar to what is in this pastie:

Pastie Database
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=414


One problem I see is that checkbox controls serialize differently (one uses "1" versus "on") and there might be other nuances. So this is not a complete solution yet and unfortunately I don't have the extra time to explore it. But it definitely can be done with script. Contact me using the information in my profile if you want to pursue this solution.

See: http://stackoverflow.com/questions/3029870/jquery-serialize-does-not-register-checkboxes