Some data, like phone numbers or Social Security numbers, must always contain a fixed number of characters. But when users make simple errorslike adding hyphens in a phone numberthey often dont know that theyve done anything wrong. In the previous section, "Creating Field Masks," we showed you how to create a field mask to format a phone-number field. In order for the mask to work properly, the user must not enter more than 10 digits. This technique prevents such simple errors from taking place.
To validate by number of characters
1 .Open a file with a phone-number field whose length you want to limit.Well use the same file we worked with in "Creating Field Masks" (Figure 3.74).
Figure 3.74. Go to the layout whose phone number field you want to change.
2 .Choose File > Define > Database (Control+Shift+D/Command+Shift+D).3 .When the Define Database dialog box appears, click the Field tab, then double-click the Phone field.4 .When the Options dialog box appears, click the Validation tab.5 .Check the "Maximum number of characters" check box and enter 10 in the box to the right (Figure 3.75).
Figure 3.75. In the Validation panel of the Options dialog box, enter the maximum number of allowed characters.
6 .Uncheck the "Allow user to override during data entry" check box (Figure 3.76).
Figure 3.76. Uncheck "Allow user to override during data entry" to prevent the user from ignoring the validation alert.
7 .If you want FileMaker to display a custom message when the user enters more than 10 characters, click the "Display custom message if validation fails" check box and type the message in the box below (Figure 3.77).
Figure 3.77. You can enter a custom message that displays if the user enters more than the specified number of characters.
8 .Click OK twice to exit.If the user enters more than 10 characters in the Phone field, FileMaker will display the alert message you entered in step 7 (Figure 3.78).
Figure 3.78. If the validation fails, the user is prompted to change the input.
TipIf youve created a very clever FileMaker database, you may want to reuse it for other projects. If you choose File > Save a Copy As and choose Clone > No Data, youll have a fresh copy of your database that you can rename. If you copy that clone to the FileMaker templates Folder (in the same folder as the FileMaker application), it will show up in the templates list when you choose File > New Database.
Keyboard Shortcuts
Many commands in FileMaker can be carried out without using a mouse. Here are some of the most useful.