KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Data Validation with Custom Code
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: November 20, 2001

When validating data in an input form, you may want to execute custom code that can possibly reject the entry until a specific condition is met.

To do so, follow the procedure below:
1- Create a button.
2- In the Variable page of the Object Properties palette, select No Action as the button's action.
3- In the Variable page of the Object Properties palette, click the Keys button and assign the Enter key as a shortcut.
If you do not assign that shortcut, the Enter key will validate the data and bypass the code used with the custom validation button.
4- Create an object method that ensures the condition is met:
The following piece of code is a simple example of what can be done:

Case of
: (Form event=On Clicked )
If (MyCondition=True)
ACCEPT
End if
End case