What is the accepted method to test if an edit field has changed?

What is the accepted method to test if an edit field has changed?

JJGJJG Posts: 14Questions: 4Answers: 0

I have a preEdit handler that populates a number of hidden fields based on the value in a single editable field. It works just fine. However, the function that populates the hidden fields runs slowly and I thus want to invoke it only when the editable field on which it is based is changed.

What is the accepted method for testing whether a specific field has changed within a preEdit handler?

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    You need to effectively cache the value when the edit starts (if that is running async, then you'll need to take that into account when storing the cached value - I can't say for certain how you would do that without being able to see the code).

    This example demonstrates how it can be done for the whole form, but you could limit it to just a few fields if you needed,

    Allan

  • JJGJJG Posts: 14Questions: 4Answers: 0

    That is too bad, I was hoping for access to a simple flag or the field compare method. My populate function has to run server side (as access to the resources it makes use of are limited), so I suppose the simplest solution is simply to re-read the original row right before I populate and then let editor do its thing.

    Thanks for your help!

    Jonathan

This discussion has been closed.