Normal Topic Limiting Number of Characters in a Field (Read 2846 times)
Alec
Lanticans
*****
Offline



Posts: 200
Location: Ascot, England, UK
Joined: Nov 22nd, 2002
Limiting Number of Characters in a Field
Feb 26th, 2004 at 8:17pm
Print Post Print Post  
Q: I need to create the equivalent of a Q&A template in a number or Text field that will limit the number of entries in the field.

A.
This code will do the trick. Put it in the relevant layout element, in the "On Element IMMEDIATE change" event. That way it is checked with each key press. Change the layout element name from "Zip" to whatever your layout element is called.  This example sets a limit of 5 characters. Change every instance of 5 to whatever you want.

-------------------------------------------------------------------------------

IF @Len(Zip) > 5 THEN
{
  Zip = @Left(Zip, 5)
  @MsgBox("", "TOO MANY CHARACTERS!" ,"Max 5")
}

  

Alec
Back to top
IP Logged