Input validation message rec'd twice

I’ve solved this problem using script in the Exiting event. However, I’d still like to know why this happened.I want to validate an Address dialog field with:

NumTest:=@TextToNumber(OffCode) ;

@If(@IsError(NumTest); @Success ; @Failure(“This field will NOT accept numbers. Please select a name from the drop-down list.”))

If the user enters a number, when they tab to the next field, it catches the number and displays the @Failure message. However, the message comes up twice followed by the Notes message, “Notes error - field did not pass validation formula.” I changed the formula to:

NumTest:=@TextToNumber(OffCode) ;

@If(@IsDocBeingSaved ;

		@If(@IsError(NumTest) ;  @Failure("This field will NOT accept numbers. Please select a banker's name from the drop-down list.") ; @Success) ;

"")

This also catches a number, but this time I get a “field didn’t pass validation formula” twice followed by the “Notes error - field didn’t…”

Any ideas? Thanks.

Subject: Your second attempt should be:

NumTest:=@TextToNumber(OffCode) ;@If(@IsDocBeingSaved;

		@If(@IsError(NumTest) ;  @Failure("This field will NOT accept numbers. Please select a banker's name from the drop-down list."); @Success);

@Success)

Subject: RE: Your second attempt should be:

Bill, thanks for your help. However, this formula needs to be backwards. The field in question is a text field so TextToNumber raises an error only when there is text in the field which is what should be there. If there is a number in the field, TextToNumber will convert it to a number and NOT raise an error. This is when I want the message to come up.

Subject: OK Then

NumTest:=@TextToNumber(OffCode) ;@If(@IsDocBeingSaved;

@If(@IsError(NumTest); 

	@Success;

	@Failure("This field will NOT accept numbers. Please select a name from the drop-down list."));

@Success);

Subject: How about this.

Use a hidden computed field to check the value of the number field to ensure its a number.

Subject: Input validation message rec’d twice

Hi Mark,

I tried copying your formula (1st option) in a test form and works fine: the error message shows up once only, as expected.

I think your issue is due to moon position in the sky because I have found the same issue in Domino5 forum

http://www-10.lotus.com/ldd/46dom.nsf/0/aee13977a8f64bfe85256f8f00573035?OpenDocument

I am pretty new to Domino/notes and I am getting another confirmation that it’s a try and pray exercise

Subject: The fault lies not in our stars but in ourselves…

… more specifically, from failure to trap errors in LotusScript code. The message “Notes error - field did not pass validation formula” comes from LotusScript when a call to NotesUIDocument.Refresh or NotesUIDocument.Save fails because a field failed validation. If this happens on leaving a field, the likely culprit is the Exiting event of the field (or the Entering event of another field). You can trap this error in LotusScript using an On Error statement and do something more sensible with it.

This works more or less the same regardless of which phase or house of the zodiac the moon is in.