The easiest way would be to use an input validation formula like the following...
@If( @Length(fieldName) > 100 ; @Failure("Field too long, blah blah blah") ; @Success );
Only problem with that approach is that the user will be alerted when they try to save the document instead of when they are editing the field.
Using LotusScript and the field's exiting event, you could also check with something like the following...
Dim workspace as New NotesUIWorkspace Dim uidoc as NotesUIDocument Set uidoc = workspace.CurrentDocument If len( clng(iudoc.FieldGetText( "fieldname" ) ) ) > 100 then Msgbox "Failed", 0, "Failure" Uidoc.GotoField( "fieldname" ) End if
Note: If the field the user goes into has an exiting event that also puts the cursor in another field, you could have trouble (i.e. the exiting events could be fighting over where to put the cursor)
This was first published in January 2002