This tip shows you how to create a re-usable validation formula. When naming a field, the only thing the user must do is add '_i'. The script will alert all of the fields that end in '_i'.
This can be expandable in different ways. If you want an alert for the number of validations, then create a field "_n" and add one more line of code to check the number condition.
It is a simple code that can be re-used and expanded according to your needs.
Dim session As New notessession Dim ws As New NotesUIWorkspace Dim db As notesdatabase Dim form As notesform Dim uidoc As notesuidocument Dim doc As notesdocument Set db=session.CurrentDatabase Set form=db.GetForm("My Form") Set uidoc=ws.CurrentDocument Set doc=uidoc.document Forall field In form.Fields If uidoc.fieldgettext(field)="" Then lenfield=Len(field)-2 fname=Left(field,lenfield) Msgbox "Please enter a value in " + fname End If End Forall
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Prasad. Please let others know how useful it is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.