Prevent Jump Featured Image

By Alexis Allen

FileMaker, UX

When a user selects a value from a drop-down list, FileMaker’s expected behaviour is to move the cursor automatically to the next field (or object) in the tab order. If that field also has a drop-down list attached, this will have the effect of activating the list.

Under normal circumstances, this is fine and even desirable. But sometimes you don’t want this to happen, and there is no native option to prevent the cursor from jumping to the next object after a user selects from a list.

Why would you want to do this in the first place? Well, I was creating a global search field at the top of a layout with a drop-down list attached, and a script trigger On Object Save that finds a set of records corresponding to the user’s list selection. I wanted it to stay on the field after the user selected an item from the list, since the interaction is essentially over at that point.

Activated ListBut it kept jumping and selecting the next object in the tab order, which in this case was a tab panel. I could of course remove all non-field objects from the tab order to prevent that, but then it would just jump to a field instead. I wanted it to stay where it was (essentially, do nothing) after the list selection.

In the past, I’ve used a second field, identical to the first—but without a drop-down list—as the next object. Then, when the selection jumps, it jumps to “itself,” and the user doesn’t see any change (which is what you want).

Drop-Down on WhiteBut this didn’t quite work how I wanted. Whenever the cursor jumped to the second field, it highlighted the contents of the field in white. As I was using white text on a coloured background, all the user ends up seeing is a white box.

Drop-down Coloured BackgroundThere is no way I could see to remove the white field fill (FileMaker doesn’t recognize it as a “fill”). I could work around it by changing the In Focus options on the field to make the text black instead of white, but it still wasn’t quite what I was looking for.

I solved the problem by using the same technique, but adding a script trigger to the second field that runs when the field is entered (which happens as a result of the drop-down list selection) and commits the record.

Here are the detailed steps:

  1. Create a script that contains one step: Commit Records/Requests (no dialog).
  2. Select your first field (the one with the drop-down list) and create a copy of it. Remove the value list and any existing script triggers from the copy.
  3. Attach a script trigger to the copied field that activates this script On Object Enter.
  4. Make sure the copied field is the next field in the tab order (Layouts > Set Tab Order) after your first field.
  5. Align both fields vertically and horizontally so they are exactly on top of each other.
  6. Select the copy and send it to the back of the original, so that the original (with the list) is on top.

Final State

That’s it! Now, when the user selects the list, nothing happens, which is exactly what you want!

UPDATE: In addition to adopting the method suggested by Matt Petrowsky in the comments below (instead of using a copied field, use Exit Script [Result: False]) to prevent the jump, I also changed the script trigger to an On Object Modify. This was because to clear their selection with On Object Save, the user had to remove the text, then click out of the field to have their results update. On Object Modify has the effect of leaving the field immediately as soon as the field text is removed.




Get Your Free Resource

Sign up to get our free Visual Design Cheatsheet sent straight to your inbox.

Alexis Allen

About the author

I'm a certified FileMaker developer based in Toronto with over 20 years of experience. I've designed solutions for desktop publishing, signmaking, packaging design, marketing and advertising. I have presented several times at the FileMaker Developer's Conference in the US on the topic of design. As a lifelong student, I enjoy all creative pursuits.

Leave a Reply

Your email address will not be published. Required fields are marked

  1. Alexis, try using the OnObjectExit trigger (on your original field – no copies) and attaching it to a script which simply uses Exit Script [ Result: False ]

    This will prevent FileMaker from continuing anything it would otherwise normally do – such as moving to the next field in the tab order.

    Exiting from any trigger with False is helpful in many situations.

  2. Sorry, on the previous comment, you likely don’t need the OnObjectExit. You should just be able to use the Exit Script False on your OnObjectSave of the Drop down list.

  3. Unless you want something to happen. I normally have two triggers on every drop-down (pop-up) menu:

    1. The first one runs a script onObjectModify that has one script step: commit.
    2. The second one runs onObjectSave and that does something with the selected text.

    The commit helps me get the contents of the global field so I can use it.

    1. That makes sense. I’ve gotten away from drop-down lists a bit lately, since the ones I use most have so many values and they get so slow as to be unusable. In those cases, I’ve been using a portal formatted like a list instead, with a type-ahead field at the top to filter the values.

      But drop-downs do have their uses at times! Thanks Agnes.

  4. Hi Alexis.

    Is there any reason you wouldn’t bypass this behaviour by using the Go To Field [] script step and not selecting a field to jump to? I’ve used this technique and it works with both Drop Down and Pop Up menus – I haven’t found any issues with it yet but of course there’s always the possibility that FM might force you to select a field in a future s/w release (though I doubt it).

    Jon

      1. Hi Jon,

        It seems that this would also work! Although if you were to do a BaseElements scan or similar on the file at some point, you might get an error that the field wasn’t specified.

        Thanks for your contribution!

        Alexis

  5. I create a ‘Focus’ script that triggers on modify and then goes to an empty field elsewhere on the layout (or a different layout) without selecting it.

  6. Not sure if this is still active …

    Simply selecting the value in the value list by using the Enter key (or Fn-Return) instead of the Return key keeps the cursor/focus on the current field …

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}