2 Replies Latest reply on Aug 24, 2012 4:47 PM by philmodjunk

    No validation error message when clicking on a button

    JohnLee

      Summary

      No validation error message when clicking on a button

      Description of the issue

      Am running into a problem where I have a field that allows a user to select from a value list.  When I select a value and then double click in the field I can change it. So for example, I select "Printer" then double click and change it to "Printe". When I click in the open areas of the layout, I get a message that the the value is not valid (which is good). BUT when I click on a button on the layout, it executes the button (without any error messages). I want an error message so the button does not execute !

      Steps to reproduce the problem

      See above.

      Expected result

      An error message that the value is not in value list AFTER I click on any button (and the button does not execute).

      Actual result

      The button executes.

      Configuration information

      FileMaker 11.

      Workaround

      None.

        • 1. Re: No validation error message when clicking on a button
          philmodjunk

          Clicking on a blank area of the layout commits the records and commiting the record is needed for some validation rules. Clicking on a button does not commit the record, but the action that takes place when the button is clicked could commit the record. (changing layouts, changing records, or the commit record step all will commit the record.

          Thus you could set up your button to perform a script where the first part of the script commits the record and exits without doing anything else if an error is detected after committing the record.

          Set Error capture [on]
          Commit Records
          If [Get ( LastError ) //there was an error from the commit ]
             Show Custom dialog ["There was a validation error']
             Exit Script []
          End If
          #Rest of your script goes here.

          • 2. Re: No validation error message when clicking on a button
            philmodjunk

            Note that you can also user the onObjectValidation trigger if you also include code in the script to test for the error instead of relying on the validation setting in field options.