2 Replies Latest reply on Sep 10, 2014 8:31 AM by philmodjunk

    Container's OnObjectValidate requires two file selections for Insert step

    Dillik

      Summary

      Container's OnObjectValidate requires two file selections for Insert step

      Product

      FileMaker Pro

      Version

      13.0v3

      Operating system version

      OS X 10.7.5

      Description of the issue

      When a container field has an OnObjectValidate script attached and a script step prompts for an image or file to be inserted in that field, the file selection will need to be made twice.

      Steps to reproduce the problem

      Assign an OnObjectValidate script of any sort to a container field. Create a button which performs Insert Picture, Insert PDF (if it's a PDF-enhanced field), or Insert File without specifying the file to use.

      When you click the button while said container field is active, you'll be prompted for a file, the OnObjectValidate script will run, and you'll again be prompted for the file.

      Actual result

      The sequence of events is as follows:
      1) file dialog
      2) OnObjectModify
      3) OnObjectValidate
      4) file dialog (again)
      5) OnObjectModify
      6) OnObjectSave

      This occurs regardless of the type of file being inserted, regardless of the optimization method of the container (image vs. interactive PDF), regardless of whether the Insert step is a raw button step or is placed within a script, and regardless of whether the OnObjectValidate script exits with an explicit True result or simply exits without Exit Script specifying a result.

      It does not happen with the Insert commands from the menu (or via right-clicking on the container).

      If OnObjectValidate is turned off for the container field, the sequence of events will instead be 1, 2, 5, 6 (only a single dialog, as expected).

      Workaround

      Don't use OnObjectValidate for container fields if an Insert step will be used anywhere.