Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Does anyone know of a way to hide a button if a text field is empty, without using 2 different layouts?

Many thanks

Eddy.

You'll want to do more than hide the button -- you'll probably want to disable it too.

Disabling is easy -- just start the script with:

If(IsEmpty(FieldName))

Exit Script

"Hiding" the button involves a global container field and a calc field that returns a container. Put a graphic in the global field that matches the background. The calc field returns the contents of the global field if the field is empty.

Of course, that solution could be a problem in a multi-user environment.

Make the button a calculation (container). You will need to store the button in a global container and then have a calculation as follows:

If(IsEmpty(MyTextField) = 0, "MyStoredGraphic", "")

The script applied to your button will still be there. The script should be designed to not do anything if "MyTextField" is empty (using the same principles that the container calculation was created with)

If you want the button functionality to completely disappear you would need to create a relationship that displays the button (and its script) in a one-line portal if there is text in your text field.

Pete

Hello EddyB,

I suggest that you click the following link:

http://www.filemakerpros.com/Visible.zip

...which leads to a free download demo file from John Mark Osbourne's DatabasePros web site.

The file is one which shows a rather neat technique which has been widely promulgated by JMO, for doing exactly what you have in mind. One useful aspect is that the same effect which causea the button to disappear will also diable it. wink.gif

  • Author

Thanks all - I will have a look at all your suggestions and I'm sure you have given me my answer!

Many Thanks

EddyB

  • Author

Ok, going with the portal idea - had a look at the DatabasePros example which uses portals to hide text fields and buttons dependant on other firelds, and it's very effective so thanks all- just what I needed!

Ed.

I see you have resolved your issue, but since I have just spent some time creating an example database with the portal concept I am attaching it here anyway.

Pete

  • Author

Thanks for spending the time on it Pete, I have downloaded your example as well as the databasepros one. I'm sure with the 2 examples now I have my answer, just got to work on it now - you know I've been developing on FMPro for about 3/4 years and never used a portal! - looks like I've been missing out!!

Many thanks

Ed.

Yes, portals literally open up a whole new window.

Enjoy it Ed

Pete

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.