Jump to content

How to conditionally hide field

This topic is 8534 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have looked in the FMP User Guide, help, FileMaker's web site, and this formum for information on how to show/hide a given field (radio button) and its label in a custom form contingent upon whether one of the buttons ("yes") has been checked. THe goal is not to encrypt information, but rather just to show the field in the custom form if and only if the "yes" button has been checked.

Can someone please point me in the appropriate direction to accomplish this?

Many thanks in advance!

Link to comment
Share on other sites

i could tell you how to do it, but you can get the same file i did through the following link. . . HOWEVER, be warned, this is a VERY addictive trick b/c it's really easy and just darn cool


then search for Visibility. The tip/ file called "More Visibility" is the one you are looking for. (on the search i just did it was fourth down).

have fun


Link to comment
Share on other sites

I have studied MoreVis.FP5 (field definitions, relationships, value list, and scripts), but still do not understand how it accomplishes the hiding because I am not an FMP programmer/developer.

Moreover, I suspect that I have a different need than what the four models in MoreVis.FP5 do.

I am thinking about having a "simplify" button on a form, which when clicked, will hide all of the radio button fields and their corresponding labels for which the radio button has not been clicked during data entry.

Specifically, each of the radio button fields is a two-choice button; one choice is "Yes" and the other is "No show." Some radio button fields do not have either of these two choices checked. The goal is to hide such a radio button field and its label.

Does FMP have a Boolean "visible" command (I've not been able to find it in the Help or User Guide) like in RealBasic? If not, how is hiding accomplished?

Many thanks in advance!

Link to comment
Share on other sites

FileMaker does not have an easy way to make things on the screen be conditionally visible. The technique in the MoreVis.fp3 file is one of the work arounds, and given what you've described as your needs, probably the best. The other solution is multiple layouts, but it sounds like there are too many possibilities to make this doable.

What is happening in the MoreVis file is that some of the fields and labels appear inside of portals. Information in portals only shows up when there is a valid relationship into which the portal looks. For instance, on the layout GDE, the field Text2 is in the portal for the GDE1 relationship. This relationship has GDE Text1 Key for the local key. This is a calculation field that is 0 when the Text1 field is empty and 1 when it is not. When this field is set to 0 there is no valid related records, so the portal doesn't show the information in it.

Something that might help is to go to the GDE layout and click on the large grey block with the fields in it and ungroup it. You'll have to use some trial and error to select them, but there are portals around the second and third fields.

So, you could take this technique to your own solution like this.

Show_Field_X (number calc field) = not IsEmpty( Field_X )

Constant (number calc field ) = 1

Field_X_Key (number field)

Self-join relationship (same file on both sides): with Field_X_Key =::Constant

Place field to hide inside portal into the self-join realtionship.

To hide field, run script:

Set Field [ Field_X_Key, Show_Field_X ]

To show field, run script:

Set Field [ Field_X_Key, 1 ]

The Hide Field script will set Field_X_Key to 0 (thereby hiding the field) only if the Field_X field is empty.

Play around with the GDE layout more, moving things out of the portal and just tinkering. It is complicated when you begin, but it's a wonderful work around to a limitation in FileMaker.


Link to comment
Share on other sites

It so8nds to me that a solution that uses two layouts -- one with full option, one simplified -- will do the trick. A button on the full layout swicthes to the lite version. A button on the lite version switches back to the full.

Easy enough for a newbie to do: duplicate the full layout and delete the stuff you wantr to hide, then create simple "go to layout" buttons to do the magic.

Link to comment
Share on other sites

Vaughn - many thanks for the reply. However, the challenge is that the fields displaying in the simplified layout need to be contingent upon having checked a radio button in the full layout. That's the trick that I still need to figure out/learn.

Once that's accomplished, then I need the simplified form to format itself so that the fields containing a selected radio button (of which there are *many*) are positioned neatly to fit on a single sheet of paper. I have no clue as to how to accomplish such automatic formatting.

Link to comment
Share on other sites

This topic is 8534 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.