I have a form with 3 phone number fields (work, home, cell). I want to create a validation formula that ensures that one of those fields has an entry. I have tried the following but it forces the first field I have this code in to have an entry.
@If(WorkPhone= “” & HomePhone=“” & CellPhone=“”; @Failure(“Please enter a phone number.”); @Success)
Any assistance would be greatly appreciated.
Thanks,
Melissa
Subject: Input validation to check values in 3 fields?
Melissa,
You need to put the validation in the 3 fields.
Putting the @Failure command in the Input Validation of FieldX means it is FieldX that will always “fail”
The exact code will work in each of the three, beacuse once one is entered, you will be fine. bear in mind though that if you have “automatically refesh fields” set on your Form, you willnot be able to get past the first field!!
HTH
MIke
Subject: RE: Input validation to check values in 3 fields?
Personally I never liked Validation formulas, I always had more luck using the querysave event in LotusScript. Try this:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
If source.fieldGetText(“WorkPhone”) = “” And source.fieldGetText(“HomePhone”)=“” And source.fieldGetText(“CellPhone”)=“” Then
messagebox(“Please enter at least one type of phone number”)
Continue = False
End sub
This is off the top of my head, so it might not be watertight, but thats how I do my validation. The Continue=False line stops the document from saving. This way the user is only informed of the problem when they try to close the document, rather than every 5 seconds when tabbing around the fields!
Subject: RE: Input validation to check values in 3 fields?
Good point Christoph.
The QuerySave event is much better for trapping erros at the end rather than constantly bombarding the user with dialog boxes everytime they tab/click in another field.
It had completely slipped my mind!!! (Well, it is Thursday - nearly the end of the week!!!)
Mike