Using CheckNumeric to validate the number fields in a WAM

Date: 25 September 2006
Product/Release: Visual LANSA V11
Abstract: The CheckNumeric option in a WAM can validate the numeric values entered in your WAMS to ensure they match the definition of the fields they are mapping to
Submitted By: LANSA Technical Support

When creating a WAM with numeric entry fields, it is possible that the user will try to enter in a value that is either too large for the field, or not a valid number. By using the CheckNumeric option, LANSA will validate and truncate (as necessary) any data input by the user with Javascript error checking.

How to use CheckNumeric:

CheckNumeric is an option that must be enabled for the entire WAM, so the option exists in the WAM definition in Visual LANSA. If you Open the WAM in the editor it will be in the details tab as seen below. It is also possible to add this by adding Checknumeric(YES) to the Begin_Com of the WAM.

Open the WAM in the editor and select the details tab

It is not necessary to regenerate the XSL after making this change.

How it works

At runtime the value  will be checked when you tab out of the field. If the entered value does not match the field definition then a warning message will pop up and the field will be automatically truncated.

Example of validation

If you want to disable the message box but leave the truncating functionality, it is possible to comment out the ALERT statement in function _isValidNumber in Std_Script.js.