11 Replies Latest reply on Feb 18, 2014 10:41 AM by RoelfWoldring

    Why does tab not work to move from field to field

    RoelfWoldring

      Title

      Why does tab not work to move from field to field

      Post

           FM PRO Advanced 12

           I have two field that I can keyboard tab into but not out of on an forum. I have spent several hours not on the forum looking for why. As well, I have check every thing that I can think of in the Manage Database or The Inspector to see if there is something different about the fields. They have on enter and on exit script triggers, but so do other fields on this form that do not have this problem. I am truly lost about why this is. I have tried deleting and replace the field with a new one. Same behaviour. So that leads me to suspect that it something about how these fields are defined, but I cannot for the life of me see what is different.

            

        • 1. Re: Why does tab not work to move from field to field
          RoelfWoldring

               I just noticed one other thing. Once I click into the field I can tab out. But not before. These are the only two fields on this form for which this is true. One is a field with a drop down list, the other is just an edit box. Tab order is defined for all of these fields.

          • 2. Re: Why does tab not work to move from field to field
            philmodjunk

                 What do the script triggers do?

                 What behavior settings have you selected on the Inspector's Data tab? Is the tab key specified as a field that will exit the field?

                 Do you have a tab order specified? (There's a Set Tab order menu option.)

            • 3. Re: Why does tab not work to move from field to field
              RoelfWoldring

                   So after going away for a day or so and coming back I have determined that its a combination of two script triggers that causes this behavior.

                   Here is the sequence

                   I hit tab on a field that has an on object exit script trigger defined for it.

                   The script executes normally since this is a "pre" event script trigger.

                   The tab to the next field is executed.

                   The next field is entered.

                   The on object enter script is executed, since this is a post event script trigger.

                   The script executes normally.

                   The field is highlighted as active.

                   I hit tab but there is no advance to the next field.

                   If I actually put the cursor into the field on which I executed the on object enter script trigger

                   then when I hit tab, the next field in the sequence becomes active.

                   When I disable script triggers, tab moves from field to field normally.

                   When I remove the on object exit script trigger from the previous field, the tab process operates normally.

                   So somehow the combination of the on object exit and on object enter script triggers in two subsequent fields is leading to this change in the normal tab behavior.

                   Any ideas on how to program around this

                    

                   Roelf

              • 4. Re: Why does tab not work to move from field to field
                philmodjunk

                     I would need to see the actual scripts performed by these two triggers.

                     To post a script to the forum:

                       
                1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
                2.      
                3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
                4.      
                5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
                6.      
                7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
                • 5. Re: Why does tab not work to move from field to field
                  RoelfWoldring

                       Scripts copied from PDF are listed below

                       I tried moving to the an on object validate script instead of an on object exit script but got the same behavior

                        

                       Roelf

                       On Object Enter Script

                        

                       Activities (Aligns with App SB Tabs): From Customer Tab: Enter New Customer Button: Set Please Fix or Fix or NA in Field to Blank
                       #In Order for This Script to Work
                       #You have to call it with on OnObjectEnter Script Trigger
                       #which calls this script and passes in a script parameter
                       #Set to GetFieldName(the name of the field selected and put here between the brackets)
                       #That means you have to customize the call for each field that you it for
                       #But at least you don't have to create a separate script for each field
                       #
                       #Necessary to Make Trace Script Sequence Work
                       If [ GlobalAppControl::GDebugTraceOnorOff = "On" ]
                       Set Field [ GlobalAppControl::GTraceScriptName ; Get(ScriptName) ]
                       Perform Script [ “Create Record in TraceScriptSequence Table” ]
                       End If
                       #Start of Script
                       Set Variable [ $ScriptInput ; Value:Get (ScriptParameter) ]
                       Set Variable [ $FieldContents ; Value:GetAsText (GetField ($ScriptInput)) ]
                       If [ $FieldContents = "Please Fix"
                       or
                       $FieldContents = "Fix"
                       or
                       $FieldContents = "NA" ]
                       Set Field By Name [ $ScriptInput; "" ]
                       Else
                       Set Field By Name [ $ScriptInput; $FieldContents ]
                       End If
                       Exit Script [ ]

                        

                       On Object Exit Script

                        

                       Activities (Aligns with App SB Tabs): From Customer Tab: Enter New Customer Button: Send Warning Message about Entering Posta…
                       #
                       #Put up a new window and add a new town to the Value list
                       #Check to see if the new town is already in list
                       #if now, add / and get ready to put it in the right field on the calling screen
                       #
                       #
                       #Necessary to Make Trace Script Sequence Work
                       If [ GlobalAppControl::GDebugTraceOnorOff = "On" ]
                       Set Field [ GlobalAppControl::GTraceScriptName ; Get(ScriptName) ]
                       Perform Script [ “Create Record in TraceScriptSequence Table” ]
                       End If
                       #Start of Script
                       Set Field [ GlobalFlagButtonMgmt::GBMPostCodeValidYesNo ; "No" ]
                       Set Variable [ $PleaseFix ; Value:"Please Fix" ]
                       If [ (CustOwners10::COPostalCode = "" )
                       or
                       (not
                       (Length(CustOwners10::COPostalCode) = 7
                       and Middle(CustOwners10::COPostalCode; 1; 1) >= "A"
                       and Middle(CustOwners10::COPostalCode; 1; 1) <= "Z"
                       and Middle(CustOwners10::COPostalCode; 2; 1) >= 0
                       and Middle(CustOwners10::COPostalCode; 2; 1) <= 9
                       and Middle(CustOwners10::COPostalCode; 3; 1) >= "A"
                       and Middle(CustOwners10::COPostalCode; 3; 1) <= "Z"
                       and Middle(CustOwners10::COPostalCode; 4; 1) = " "
                       and Middle(CustOwners10::COPostalCode; 5; 1) >= 0
                       and Middle(CustOwners10::COPostalCode; 5; 1) <= 9
                       and Middle(CustOwners10::COPostalCode; 6; 1) >= "A"
                       and Middle(CustOwners10::COPostalCode; 6; 1) <= "Z"
                       and Middle(CustOwners10::COPostalCode; 7; 1) >= 0
                       and Middle(CustOwners10::COPostalCode; 7; 1) <= 9
                       )
                       )
                       or
                       (CustOwners10::COPostalCode = $PleaseFix) ]
                       // Set Field [ CustOwners10::COPostalCode; $PleaseFix ]
                       February 18, 2014 11:56:52 KennelLandV7.fmp12 - Send Warning Message about Entering Postal Code -1-

                        

                       Called Script (by above script)

                        

                       App Utility: Manage Value Lists: Add New Postal Code to Value List
                       #
                       #Put up a new window and add a new town to the Value list
                       #Check to see if the new town is already in list
                       #if now, add / and get ready to put it in the right field on the calling screen
                       #
                       #
                       #Necessary to Make Trace Script Sequence Work
                       If [ GlobalAppControl::GDebugTraceOnorOff = "On" ]
                       Set Field [ GlobalAppControl::GTraceScriptName ; Get(ScriptName) ]
                       Perform Script [ “Create Record in TraceScriptSequence Table” ]
                       End If
                       #Start of Script
                       Set Variable [ $PleaseFix ; Value:"Please Fix" ]
                       If [ not (GlobalFlagButtonMgmt::GBMByPassSetGTextInputtoBlank = "Yes") ]
                       Set Field [ GlobalAppControl::GTextInput ; "" ]
                       End If
                       Set Field [ GlobalFlagButtonMgmt::GBMByPassSetGTextInputtoBlank ; "No" ]
                       #Open and Close Hidden Windown
                       Set Variable [ $CameFromWindow ; Value:Get (WindowName) ]
                       Set Variable [ $GoBackToLayout ; Value:Get (LayoutName) ]
                       Set Variable [ $ThisScriptWindow; Value:"HW"&Get(ScriptName) ]
                       New Window [ Name: $ThisScriptWindow; Height: 600; Width: 600; Top: 50; Left: 350; Style: Document ; Close: “Yes” ; Minimize: “Yes” ; Maximize: “Yes” ; Zoom Control Area:
                       “Yes” ; Resize: “Yes” ]
                       Go to Layout [ “Add a New Postal Code to the Value List” (VLEPostalCode) ]
                       Go to Field [ GlobalAppControl::GTextInput ]
                       Enter Browse Mode
                       Pause/Resume Script [ Indefinitely ]
                       Set Variable [ $WorkingName ; Value:GlobalAppControl::GTextInput ]
                       #
                       Freeze Window
                       Enter Find Mode [ ]
                       Set Error Capture [ On ]
                       Set Field [ VLEPostalCode::VLEPostalCodeText ; $WorkingName ]
                       Perform Find [ ]
                       Set Variable [ $FoundCount ; Value:Get (FoundCount) ]
                       February 18, 2014 11:55:36 KennelLandV7.fmp12 - Add New Postal Code to Value List -1-

                        

                        

                  • 6. Re: Why does tab not work to move from field to field
                    RoelfWoldring

                         Sorry

                          

                         Looking at the above

                         I just realized that the I only copied the first page of the script from the PDFs

                          

                         here are the full versions of the second two script

                          

                         I will need to spend a little time cleaning thing up before posting them again.

                          

                         Roelf

                          

                          

                          

                          

                    • 7. Re: Why does tab not work to move from field to field
                      RoelfWoldring

                           On Object Enter Script

                            

                           #In Order for This Script to Work
                           #You have to call it with on OnObjectEnter Script Trigger
                           #which calls this script and passes in a script parameter
                           #Set to GetFieldName(the name of the field selected and put here between the brackets)
                           #That means you have to customize the call for each field that you it for
                           #But at least you don't have to create a separate script for each field
                           #
                           #Necessary to Make Trace Script Sequence Work
                           If [ GlobalAppControl::GDebugTraceOnorOff = "On" ]
                           Set Field [ GlobalAppControl::GTraceScriptName ; Get(ScriptName) ]
                           Perform Script [ “Create Record in TraceScriptSequence Table” ]
                           End If
                           #Start of Script
                           Set Variable [ $ScriptInput ; Value:Get (ScriptParameter) ]
                           Set Variable [ $FieldContents ; Value:GetAsText (GetField ($ScriptInput)) ]
                           If [ $FieldContents = "Please Fix"
                           or
                           $FieldContents = "Fix"
                           or
                           $FieldContents = "NA" ]
                           Set Field By Name [ $ScriptInput; "" ]
                           Else
                           Set Field By Name [ $ScriptInput; $FieldContents ]
                           End If
                           Exit Script [ ]

                            

                           On Object Exit Script

                           #
                           #Put up a new window and add a new town to the Value list
                           #Check to see if the new town is already in list
                           #if now, add / and get ready to put it in the right field on the calling screen
                           #
                           #
                           #Necessary to Make Trace Script Sequence Work
                           If [ GlobalAppControl::GDebugTraceOnorOff = "On" ]
                           Set Field [ GlobalAppControl::GTraceScriptName ; Get(ScriptName) ]
                           Perform Script [ “Create Record in TraceScriptSequence Table” ]
                           End If
                           #Start of Script
                           Set Field [ GlobalFlagButtonMgmt::GBMPostCodeValidYesNo ; "No" ]
                           Set Variable [ $PleaseFix ; Value:"Please Fix" ]
                           If [ (CustOwners10::COPostalCode = "" )
                           or
                           (not
                           (Length(CustOwners10::COPostalCode) = 7
                           and Middle(CustOwners10::COPostalCode; 1; 1) >= "A"
                           and Middle(CustOwners10::COPostalCode; 1; 1) <= "Z"
                           and Middle(CustOwners10::COPostalCode; 2; 1) >= 0
                           and Middle(CustOwners10::COPostalCode; 2; 1) <= 9
                           and Middle(CustOwners10::COPostalCode; 3; 1) >= "A"
                           and Middle(CustOwners10::COPostalCode; 3; 1) <= "Z"
                           and Middle(CustOwners10::COPostalCode; 4; 1) = " "
                           and Middle(CustOwners10::COPostalCode; 5; 1) >= 0
                           and Middle(CustOwners10::COPostalCode; 5; 1) <= 9
                           and Middle(CustOwners10::COPostalCode; 6; 1) >= "A"
                           and Middle(CustOwners10::COPostalCode; 6; 1) <= "Z"
                           and Middle(CustOwners10::COPostalCode; 7; 1) >= 0
                           and Middle(CustOwners10::COPostalCode; 7; 1) <= 9
                           )
                           )
                           or
                           (CustOwners10::COPostalCode = $PleaseFix) ]
                           // Set Field [ CustOwners10::COPostalCode; $PleaseFix ]

                           Set Field [ GlobalFlagButtonMgmt::GBMPostCodeValidYesNo ; "No" ]
                           Show Custom Dialog [ Title: "Invalid Postal Code"; Message: "Canadian Postal Codes must be in A9A 9A9 format.
                           ¶You entered " & CustOwners10::COPostalCode &
                           "¶Click OK to fix this code please before continuing on."; Default Button: “OK”, Commit: “No” ]
                           Go to Field [ CustOwners10::COPostalCode ]
                           Halt Script
                           Else
                           Set Field [ GlobalFlagButtonMgmt::GBMPostCodeValidYesNo ; "Yes" ]
                           End If
                           Set Variable [ $WorkingName ; Value:CustOwners10::COPostalCode ]
                           Set Field [ GlobalFlagButtonMgmt::GBMByPassSetGTextInputtoBlank ; "No" ]
                           Set Variable [ $CameFromWindow ; Value:Get (WindowName) ]
                           Set Variable [ $GoBackToLayout ; Value:Get (LayoutName) ]
                           New Window [ Name: $ThisScriptWindow; Height: GlobalsforDebug::GFDWindowHeight; Width: GlobalsforDebug::GFDWindowWidth; Top: GlobalsforDebug::GFDWindowFromTop;
                           Left: GlobalsforDebug::GFDWindowFromLeft; Style: Document ; Close: “Yes” ; Minimize: “Yes” ; Maximize: “Yes” ; Zoom Control Area: “Yes” ; Resize: “Yes” ]
                           Go to Layout [ “Add a New Postal Code to the Value List” (VLEPostalCode) ]
                           Enter Find Mode [ ]
                           Set Error Capture [ On ]
                           Set Field [ VLEPostalCode::VLEPostalCodeText ; $WorkingName ]
                           Perform Find [ ]
                           Set Variable [ $FoundCount ; Value:Get (FoundCount) ]
                           If [ $FoundCount > 0 // in list so ok ]
                           Go to Next Field
                           Exit Script [ ]
                           Else
                           Set Field [ GlobalFlagButtonMgmt::GBMByPassSetGTextInputtoBlank ; "Yes" ]
                           Set Field [ GlobalAppControl::GTextInput ; $WorkingName ]
                           Perform Script [ “Add New Postal Code to Value List” ]
                           End If
                           Go to Next Field
                           Exit Script [ ]

                            

                            

                           Script Called by Abvove Script

                           #
                           #Put up a new window and add a new town to the Value list
                           #Check to see if the new town is already in list
                           #if now, add / and get ready to put it in the right field on the calling screen
                           #
                           #
                           #Necessary to Make Trace Script Sequence Work
                           If [ GlobalAppControl::GDebugTraceOnorOff = "On" ]
                           Set Field [ GlobalAppControl::GTraceScriptName ; Get(ScriptName) ]
                           Perform Script [ “Create Record in TraceScriptSequence Table” ]
                           End If
                           #Start of Script
                           Set Variable [ $PleaseFix ; Value:"Please Fix" ]
                           If [ not (GlobalFlagButtonMgmt::GBMByPassSetGTextInputtoBlank = "Yes") ]
                           Set Field [ GlobalAppControl::GTextInput ; "" ]
                           End If
                           Set Field [ GlobalFlagButtonMgmt::GBMByPassSetGTextInputtoBlank ; "No" ]
                           #Open and Close Hidden Windown
                           Set Variable [ $CameFromWindow ; Value:Get (WindowName) ]
                           Set Variable [ $GoBackToLayout ; Value:Get (LayoutName) ]
                           Set Variable [ $ThisScriptWindow; Value:"HW"&Get(ScriptName) ]
                           New Window [ Name: $ThisScriptWindow; Height: 600; Width: 600; Top: 50; Left: 350; Style: Document ; Close: “Yes” ; Minimize: “Yes” ; Maximize: “Yes” ; Zoom Control Area:
                           “Yes” ; Resize: “Yes” ]
                           Go to Layout [ “Add a New Postal Code to the Value List” (VLEPostalCode) ]
                           Go to Field [ GlobalAppControl::GTextInput ]
                           Enter Browse Mode
                           Pause/Resume Script [ Indefinitely ]
                           Set Variable [ $WorkingName ; Value:GlobalAppControl::GTextInput ]
                           #
                           Freeze Window
                           Enter Find Mode [ ]
                           Set Error Capture [ On ]
                           Set Field [ VLEPostalCode::VLEPostalCodeText ; $WorkingName ]
                           Perform Find [ ]
                           Set Variable [ $FoundCount ; Value:Get (FoundCount) ]

                           If [ $FoundCount = 0 // no duplicates ]
                           #Save it - happens below
                           Else
                           Show Custom Dialog [ Title: "This Postal Code is already in the drop down list."; Message: "The Postal Code you entered = "& $WorkingName & " is already in the drop down
                           list " & $FoundCount & " times.
                           ¶Click OK to return to the input screen and select it."; Default Button: “OK”, Commit: “No” ]
                           Perform Script [ “Close Window After Setting Global Text Input to Blank” ]
                           Halt Script
                           End If
                           #
                           #Add new record to the TownCity Value List Table
                           Enter Browse Mode
                           New Record/Request
                           Set Field [ VLEPostalCode::VLEPostalCodeText ; $WorkingName ]
                           Commit Records/Requests
                           [ Skip data entry validation; No dialog ]
                           Select Window [ Name: $CameFromWindow; Current file ]
                           Go to Layout [ $GoBackToLayout ]
                           Set Field [ CustOwners10::COPostalCode ; GlobalAppControl::GTextInput ]
                           Set Field [ GlobalAppControl::GTextInput ; "" ]
                           Go to Field [ CustOwners10::COLandPhone ]
                           Refresh Window
                           Close Window [ Name: $ThisScriptWindow; Current file ]
                           #End of Open and Close Hidden Windown
                           Exit Script [ ]

                            

                            

                      • 8. Re: Why does tab not work to move from field to field
                        philmodjunk

                             Your middle script seems incomplete. It ends with an If step, but there's no End IF. I assume that there was more on a second page that did not make it into your post. And I don't see a perform script step that would make sense as the call to perform the third script.

                             But from what I see, I suspect that another unlisted script: Create Record in TraceScriptSequence Table, could be the culprit here.

                             Does this script change layouts in order to create a new record in a different table? If so, that will change the focus from your current field to the first field in your tab order and that could easily affect the results you get when the triggers are in place vs when they are not.

                        • 9. Re: Why does tab not work to move from field to field
                          RoelfWoldring

                               Thanks

                               That is very helpful.

                               I use that trace script to follow thru my users pattern of use.

                               It runs as the first step in every script and has paid off more than once as a debugging tool.

                               I am using the on object exit script to dynamically add a new value to the value list if the user add a new value in the field.

                               I will convert that behavior to one in which they click a button to add a new value.

                               That will keep me from attaching more than 1 script trigger to a field on this layout.

                               And I will remember that it you change layouts you can get into trouble with the tab sequences when you go to the original layout. 

                                

                               Finally, is there any way that the Go to Field script step could have a "by calculation option" added in some future release.

                               Then I could do the equivalent of "keystroking" into the field in a script which get the current field as a piece of script input.

                               That would also get around this issue nicely.

                                

                               Thanks for you help.

                                

                               Roelf

                          • 10. Re: Why does tab not work to move from field to field
                            philmodjunk
                                 

                                      Finally, is there any way that the Go to Field script step could have a "by calculation option" added in some future release.

                                 I don't work for FileMaker Inc. and thus have no say in what new features might be added in a future release.

                                 You are welcome to use the feature request form if you so choose to do so: http://www.filemaker.com/company/contact/feature_request.html

                            • 11. Re: Why does tab not work to move from field to field
                              RoelfWoldring

                                   Sorry

                                    

                                   I am so used to you being so helpful to some many people

                                   that I sorta of assumed.

                                   They would be lucky to have you.

                                   Thanks for your help