devxlogo

Field-level and interfield validations

Field-level and interfield validations

Question:
Field-level validations should be done when the user visits the field. How can this be done?

Interfield validations on the same screen also should be done when the user visits the latter field. Is this possible?

Answer:
The perfect method for validation is the aptly named Validate(), fired whenever a user changes a value in a fieldand leaves the field.

Regarding interfield validation, your description is slightly off base. Ina graphical application, you have no way of controlling which field is ‘last’ to be visited. The way I would implement this isto declare a user-defined method and call the method from theValidate() method for all of the the fields that participate in thevalidation.

See also  How to Avoid Money Transfer Scams  
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