Validating text input into a numeic field
Posted on 2000-05-17
Ive got a validation question for you.
On a form I want to validate that the value entered into a numeric field is actually a numeric.
Ive looked at the input validation section but that only seems to check on a save. I need to check as soon as someone leaves the field.
So...what Ive done is put some script into the Exiting event.
Ive got this...
Sub Exiting(Source As Field)
Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.document
If (Isnumeric(doc.annualdays(0)) = True) Then
Msgbox "You must enter a numeric value for this field",48,"Numeric Field Error"
Now this works ok if you have a space or number in the field, but if you put a character in - 'a' for instance, then the script generates an error to the effect of "Variant does not contain a container"
Obviously this isnt an ideal error message for users...
Does anyone know how I can accomplish this?