devxlogo

User changes

User changes

Question:
I want to be able to take an action when a user changes the value of a data field, but not when the value of the field is changed by code. How can I do this?

Answer:
The PostChange() method for a data field is called whenever the value of the field is changed by code or user interaction. The Validate() method is only called when a value is changed by a user.

When the Validate() method is called, the Value of the data field is the original value of the field. The new value for the field is in a variable called newval. You can compare the new value and the old value and in the Validate() method.

If you return TRUE from the Validate() method, normal processing continues. If you return FALSE from the method, the focus is left in the data field and subsequent actions are cancelled. You have to remember to explicitly return TRUE from the Validate() method; the default return is FALSE, which can cause unintended results.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist