3 Replies Latest reply on Dec 21, 2013 4:15 PM by philmodjunk

    Field/Validation question

    dgupta

      Title

      Field/Validation question

      Post

           Hello,

           I would like to set the maximum number of characters in a field to, say, 8.  Is there a way of arresting the number of characters to 8 when the user is entering in the field, rather than allowing the user to enter any number, and then FileMaker throwing up a message saying the limit has been reached?

           Regards,

            

            

        • 1. Re: Field/Validation question
          philmodjunk

               Another option is to simply use an auto-enter calculation to delete the additional characters instead of showing a validation message.

               In theory, you could use OnObjectKeystroke to refuse all keystrokes except those for the delete or that exit the field once the length of the data reaches a specified max length. In such a script, you can end execution with Exit Script [False] to ignore a keystroke.

          • 2. Re: Field/Validation question
            dgupta

                 Dear Phil

                 Thank you for your response.  THis question has been asked before and I saw a previously suggested script of yours, as below.  This works absolutely fine.

                  

                 #This script limits the number of characters in YourTable::YourField to 10
                 If [ Length ( YourTable::YourField ) ≥ 10 And Code ( Get ( TriggerKeystroke ) ) ≠ 8  etc..
                 Exit Script [Result:False]
                 End If

                  

                 Thank you,

            • 3. Re: Field/Validation question
              philmodjunk

                   It has limitations. Once 10 characters have been entered, any "edit" keystroke other than the backspace (8) won't work.