8 Replies Latest reply on Oct 10, 2013 7:54 AM by disabled_rcmiller9

    controlling tab ORDER with scripts or triggers

      Title

      controlling tab ORDER with scripts or triggers

      Post

           Can the tab ORDER (not tab objects) be controlled with scripts or triggers?  For example, a user selects a type of donation from a drop-down list (money, food, or other).  If the user chooses "money",  the tab order will jump to a field for amount of money.  If the user chooses "food", the tab order will jump to a field for pounds of food.  Etc, etc.  It would seem that the OnObjectExit trigger might be useful, but no success so far.  Thaks.

        • 1. Re: controlling tab ORDER with scripts or triggers
          TKnTexas

               You would script OnObjectExit would be scripted the next field based on the contents of that field.  Scripting would override the tab-order, not change it.  Tab-order would not play a factor in your design, as I understand your question.

          • 2. Re: controlling tab ORDER with scripts or triggers
            gcatnine

            field trigger: OnObjectModify

            Associated script:

                 Commit Record/Request

                 If ( YourTable::ModifiedField = "Money")

                     GoTo Fileld (Table::AmountofMoney)

                 ElseIf (YourTable::ModifiedField = "Food")

                    GoToField (...

                 etc

            • 3. Re: controlling tab ORDER with scripts or triggers
              philmodjunk

                   Yes, but you have to keep the "event" that tripped the OnObjectExit script trigger from being processed after the script is performed by the script trigger. Otherwise, your script uses go to field to put the cursor in the specified field only to have FileMaker then process the triggering event and put the cursor in the next field of the tab order as though your script had never been performed.

                   To keep the triggering event from being processed in "before the event" script triggers like OnObjectExit, use this script to end the script:

                   Exit Script [False]

                   If you look up Script Triggers in FileMaker help, you can get a table listing all triggers and which, like OnObjectExit perform the script before the triggering event is processed and thus can take advantage of this scripting technique.

              • 4. Re: controlling tab ORDER with scripts or triggers
                gcatnine

                     Using OnObjectExit trigger it does not work and it moves on the following next field (tested)

                     Using OnObjectModify trigger it works and jumps to the desired field (as in the script) (tested)

                • 5. Re: controlling tab ORDER with scripts or triggers
                  philmodjunk
                       

                            Using OnObjectExit trigger it does not work and it moves on the following next field (tested)

                       Not if you end the script with Exit Script [False] to keep the "triggering event" from being processed after the script completes. wink

                       OnObjectModify is a good option for pop up menus, radio buttons and check boxes, but not a good option for edit boxes and drop down lists as you can trip that trigger with every keystroke.

                       OnObjectKeystroke, BTW,  can be a good option with Edit boxes and drop downs as you can detect tab, enter, return key strokes and take the user to the next field, but ignore mouse clicks that also exit the field.

                  • 6. Re: controlling tab ORDER with scripts or triggers
                    gcatnine

                         I do not understand why you say that the OnObjectModify  it is not good for dropdown list.

                         I agree with you only in the case you have a dropdown list with the "Auto-complete using existing values" option activated; in this case the script is activated at each keystroke. Otherwise, in a dropdown list, without that option activated, you select only one element from the list (so 1 keystroke).

                         Moreover, using OnObjectExit, if the field is not saved authomatically, you have to commit the record before.

                         I suggested "OnObjectModify" because Robert Miller has a dropdown list with a very simple list (money, food, or other)

                    • 7. Re: controlling tab ORDER with scripts or triggers
                      philmodjunk

                           With a drop down list, you are able to type data directly into the field even if auto-complete is not enabled and this will trip the OnObjectModify trigger with every keystroke.

                           

                                using OnObjectExit, if the field is not saved authomatically, you have to commit the record before.

                           I have not found that to be the case.

                      • 8. Re: controlling tab ORDER with scripts or triggers

                             First, a "Thank You" to forum members who responded to my question.  It's gratifying to know that a relative newcomer to FileMaker can find experienced help on this Forum.

                             It seems that there is a debate between using the OnObjectModify trigger or OnObjectExit trigger.  I chose to try the OnObjectModify first because it seemed less complicated.  (Because my dropdown list is very simple, I took the "Auto-complete..." out of the picture completely.)  The OnObjectModify trigger coupled with the suggested script works OK; however, I had to eliminate the CommittRecord/Request step from the script.  If that script step is included, the user starts to add a new record at the bottom of the portal, but has to complete it at the top of the portal (I assume this behavior is caused by the sorting.)  At any rate, everything seems to be working as I hoped.  Thank again.