Manage Learn to apply best practices and optimize your operations.

Dynamic field validations in LotusScript

This tip shows you how to create a re-usable validation formula.

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.

Dig Deeper on LotusScript

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close