8 Replies Latest reply on Aug 16, 2011 1:46 PM by KimberlyMadore

    Fully control off-record commit by script only

    RedL

      Title

      Fully control off-record commit by script only

      Post

      I would like to control the record commit by my own scripts which are trigged by two buttons - Save(commit record) and Cancel(Revert record).  I disable autosave on the layout and without attaching script to OnRecordCommit script trigger.  And FM will display the attached dialogue when I click off-record area.  How can I disable the dialogue and disable FM's record commit? 

      Commit.jpg

        • 1. Re: Fully control off-record commit by script only
          RedL

          Can anyone help on this?

          • 2. Re: Fully control off-record commit by script only
            philmodjunk

            Turn auto-save back on.

            Write a script like this:

            Show Custom Dialog ["Save record?]  // specify Save as button name in place of OK
            If [ Get ( LastMessageChoice ) = 2 /* cancel was clicked */]
               Revert Record [no dialog]
            End If

            In layout setup, assign this script to the On RecordCommit script trigger.

            • 3. Re: Fully control off-record commit by script only
              RedL

              Yes, it is a solution.  We would like save it only after all of the fields are entered.  With this solution, the custom dialog will be activated when user click off record area anytime before user complete all fields.  That's not what we want.  We want to commit record only when user complete all fields and decide to save it.

              • 4. Re: Fully control off-record commit by script only
                philmodjunk

                You can intercept the layout background mouse click that triggers the commit record by Placing an invisible, blank web viewer behind all your fields and buttons sized to cover the entire body of your layout. Then clicking the background won't trigger the commit record action.

                It's a Kludge, but it works.

                • 5. Re: Fully control off-record commit by script only
                  RedL
                  I have a blank invisible web viewer. Everything is pretty good.  But FMP save dialog still come out, if user goes to different layout or next record without click save command. How can I trap it?
                  • 6. Re: Fully control off-record commit by script only
                    philmodjunk

                    Use a script trigger or build code into your navigation buttons (If you have some that take you to different layouts) that includes the commit record script step with the no dialog option specified to keep the save dialog from appearing.

                    If you want to keep the record from being committed... well you can't. FileMaker must commit the record before allowing you to change layouts or move to a different record.

                    • 7. Re: Fully control off-record commit by script only
                      KimberlyMadore

                      I'm running into the same issue:

                      I have a form that I want to commit only after all the fields have been completed and the user clicks a "save" button (or a "cancel" button to revert any changes).

                      I have turned off autosave on the layout and added a script to OnRecordCommit to only allow commits if a global variable has been set.  I have setup navigation and "new record" and my "save" buttons to check for the fields and to instruct the user to complete missing information, before it allowing "commit Record".

                      I 'm having the same issue with clicking on the background and getting the pop up noted above.  I've tried to use the web viewer, which seems to work well on my laptop.  However, when I use the database file on an ipod touch the screen displays all white/gray with a refresh button, despite the web viewer being empty, transparent, and behind all the other objects of my layout.

                      Any way to block the pop-up message in a way that's compatible with Filemaker Go?

                      • 8. Re: Fully control off-record commit by script only
                        KimberlyMadore

                        nevermind.  I found my issue: I turned Auto-save back on and it works as I wanted.  Thanks to Todd Geist's Devcon session for Comit Record! :)