AnsweredAssumed Answered

Controlling off-record commits. How to disable commits in certain situations?

Question asked by BroadwayJoe on Mar 16, 2010
Latest reply on Apr 9, 2010 by LeoB


Controlling off-record commits. How to disable commits in certain situations?


Is there a way to keep FM10 from committing when clicking off-record, changing layouts, and so forth? I want to control the committing and only commit on a button-press. The button-press script has a Commit Records/Requests script step.


I’ve tried to use the Layout Trigger for OnRecordCommit and returning False (which stops the Commit when the user clicks off-record). However, it also triggers when the scripted OnRecordCommit executes. (And in that case I do want it to Commit.)


Here is the situation in more detail:


When the layout is opened, a script creates a New Record. One of the fields is automatically filled with today’s date. Another field is required by validation to be non-empty. The layout has two buttons. One says “Save” and the other says “Start over.” The Save button script Commits the record and opens a new one. The “Start over” button reverts and opens a new record. (Both open new records because I don’t want anyone to use this form to browse; the users are just entering info.)


Also on the layout are a pair of buttons to Show and Hide a log. The log is just another layout opened in another window (showing everything entered so far, as a list). The Show button script creates the window if it does not exist and opens the layout. The Hide button closes the window.


Here’s the problem: I don’t want to display the FM10 alert dialogs but instead want to control the interaction. If, for example, the user presses Show, FM tries to Commit the record because Show can open a new layout (in another window). I want Show to leave the record open, Show the log, and return to the open record so the user can finish. Another example: the user doesn’t fill out any fields but just clicks off-record. FM tries to Commit the record because it has been made “dirty” by the auto-entered date. In that case, I want FM to just ignore the off-record click.


Maybe this is way too much information. But I’ve tried various trigger traps and have set flags in global variable and it is getting way too complicated. I’m new to FM (except for using it years ago). I figure you folks must know of a better way to do what I want. Which in summary is: don’t commit unless I tell you to.


Filemaker Pro 10 on Mac OS X.