4 Replies Latest reply on May 31, 2012 2:39 PM by Kamasoto

    Tab Order in Portals



      Tab Order in Portals



      I have a portal with many fields reflecting various characteristics of human cells in a IVF center. In order to make easier the introduction of data, the Tab Order should go from a Field A to the next portal row Field A and only later on to Field B of the first row again.

      How to build a script that makes the Tab Order to go into the next row in the same field instead of the next field in the same row? Thanks in advance.

        • 1. Re: Tab Order in Portals

          So you want to enter data top to bottom instead of left to right?

          You can use a script trigger to do this. OnObjectExit looks like a good choice, but I recommend against it. If you use that option, clicking a button on your layout when the cursor is in a portal field will trip the trigger and put the cursor in the next row down and this can really confuse your users.

          Instead, use OnObjectKeystroke and check for any keystrokes that you want to have exit the field and jump down to the next portal row.

          Have your OnObjectKeystroke trigger perform this script:

          If [ Get ( Triggerkeystroke ) = Char ( 9 ) // tab key ]
             Go to Portal Row [next]
             Go to Field [Select field for cursor to appear in here]
             Exit Script [False] //keeps tab from putting cursor in next field in tab order after script exits
          End If

          Codes for enter and return are 10 and 13 respectively (you can find a number of useful character codes if you looke up "code" in Help.)

          Since FileMaker can't select a field for the cursor dynamically, you'll need one such script for each field in the portal row or a set of If steps that use the current field name to use different instances of Go To Field to put the cursor where it needs to go.

          • 2. Re: Tab Order in Portals

            Great, PhilModJunk, thank you, that make the job.

            To be used with any field, I dared to modify your solution a litle and works perfectly! Thanks again!

            If [ Get ( Triggerkeystroke ) = Char ( 9 ) ]
               Set Variable ($Row; Value:Get (ActivePortalRowNumber)
               Go to Portal Row (No dialog; $Row+1)
               Exit Script [False]
            End If

            • 3. Re: Tab Order in Portals

              Set Variable ($Row; Value:Get (ActivePortalRowNumber)
                 Go to Portal Row (No dialog; $Row+1)


              Go To Portal Row [Next]

              do exactly the same thing.

              If leaving out the go to field step leaves the cursor in the correct field for each field in your portal row where you want this to happen, then that should also work if you use Go to Portal Row [next].

              I assumed that changing portal rows would put the cursor in the first field in the row--which is why I included the go to field step.

              • 4. Re: Tab Order in Portals

                Thanks again Phil.

                With all your valuable Tips the confusion of Tab Order in the Portal get finally a logical sense. I have been fighing against this for a long time and hope it is of help also to other developers. Have a nice day Phil.