Lotus Notes FAQ Visit Our Sponsor!

How do you restrict a field to contain alphanumeric characters only?

This is an example of code that uses regular expressions to limit a field's entry. Put this in a field's Input Validation formula:
  @If(
    @Matches(Serial_Num; "+{0-9}"); @Success;
    @Matches(Serial_Num; "+{a-zA-Z}"); @Success;
    @Do(@Prompt([OK]; "Invalid Serial Number"; "The Unit Serial Number contains an illegal character, probably a carriage return.  Please remove the illegal character and save again."); @Return(""))
  )


Applies to Notes Versions: 4 4.5 4.6 5
Last Modified: October 27, 1997