[Forums] [Shop] [Resources] [Training] [About] [Solutions] [Consulting] [News] [Links]

Questions s I hope you enjoy this FREE online training. Let me know if you'd like to see more! You can email me at jmo@filemakerpros.com. And, if you really like this online training, consider one of my live classes based on my wildly popular book and CD ROM. Happy FileMaking!

Making Buttons Disappear

Wouldn't it be nice if you could make buttons conditionally appear and dissapear from the layout? There are plenty of workarounds that use multiple layouts, conditional scripts or calculations. However, all these techniques have limitations. For instance, the calculation method results in a graphic representing your button under one condition and no graphic under another condition. This works fine except that the button still highlights even when the graphic is not displaying.

The following technique shows you how to completely remove a button from the layout with a single relationship and a simple calculation. Let's say you want the button to appear when all of the fields on the layout are filled. If you have three fields on your current layout, your calculation field formula would be:

Case(IsEmpty(Field 1) or IsEmpty(Field 2) or IsEmpty(Field 3), "", 1)


Once you have the calculation completed, you can define the relationship. This relationship will be a same file relationship. Instead of relating to a second file, the relationship will look at itself. In other words, FileMaker will ask you to locate a file when creating a relationship. Just locate the file where you are creating the relationship.


Notice that the Conditional Calculation you just created is on the left side of the relationship and a field called Constant is on the right side. The Constant Calculation is a simple formula, resulting in the number one (1). Any time the Conditional Calculation results in a one, the relationship will become valid. Otherwise, it results in blank ("") and the relationship is invalid.

Now all you need is a single row portal with your button inside the portal.



Once you have created the portal, set the fill and pen color to the same as your background color. This will make the portal invisible.



That's all there is to it. The relationship that the portal is linked to will not be valid until the Conditional Calculation match field contains a one (1). This will only happen if all three fields are filled. When the relationship is valid, the button will appear on the layout. When the relationship is invalid, the button will disappear from the layout.

The possibilities for this technique are endless. You can require users to enter all of the fields before they can continue. You could make different buttons appear depending on user selection. It's up to you!

Download an example FileMaker file  Mac  Win .

DONE


Exclamation s Database Pros offers training classes across the globe. Classes include the wildly popular Intermediate and Advanced Scriptology training series.


Database Pros