10 Replies Latest reply on Aug 24, 2015 4:43 AM by serval

    How to do data entry validation on tabbing to another field?

    serval

      I want to do entry validations, checking that no more than 2 digits have been entered to the right of the decimal point in several fields. The check is simple: 

      Open up the Options for the field,

      Use the Validation section:

      Strict Data type of “Numeric Only”

      and

      “Validated by calculation”

      with a custom error message.

       

      The calculation is

      100*x - Int ( 100*x )   =  0

      where “x” is the field name.

       

      The problem is that Filemaker only runs validation checks when the record is committed (which happens if the user clicks outside any field), and I want to check as soon as the user leaves the field, even by tabbing or clicking into another field.

       

      The solution is to assign an OnObjectValidate triggered script. So I have a script assigned to this field:

       

      Go to Field []

      Exit Script []

       

      If I enter more than 2 digits to the right of the decimal, this does issue my error message as soon as I tab to another field, but it gives choices of “Revert Record” and “OK”.  If I click “OK”, Filemaker comes up with dialog box saying, “Go to Field has been canceled. Do you wish to continue with this script?” with choices of “Cancel” and “Continue”. If “Continue” is taken, it accepts the extra digits.

       

      Same behavior if I change the script to just

      Go to Field []

       

      Changing the script to just

      Exit Script []

      is no different than not having the onObjectValidate trigger and does not catch error immediately on tabbing to another field.

       

      How do I do the validation without giving the user a way to leave the excess digits in the field, and without giving error messages that refer to “Go to Field”, for which the user will not know what the message is talking about?