Sunday, December 11, 2011

Validating number fields in Lotus Notes

Anyone who has created number field on form and done validations on that will have faced this problem.

Suppose you have a number field on a form and user enters a value other than number in it and the form gets refreshed, either by F9 (CTRL+F9 in 8.5.x) or via code to validate other fields, then Lotus Notes comes up with a beautiful error of "Cannot convert text to a number".

You don't want this message to come when you want to execute your own custom code to display error messages and show it to user. To get around this error just
add @Success in the "Input Validation" of the number field.

But beware if your validation fails and user is able to enter a value other than number in the number field then the document will get saved and in the document properties you will get "Cannot convert text to a number" in the number field.

No comments:

Post a Comment