EddyB Posted May 13, 2003 Posted May 13, 2003 Does anyone know of a way to hide a button if a text field is empty, without using 2 different layouts? Many thanks Eddy.
danjacoby Posted May 13, 2003 Posted May 13, 2003 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.
Peter Fenner Posted May 13, 2003 Posted May 13, 2003 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
CobaltSky Posted May 13, 2003 Posted May 13, 2003 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.
EddyB Posted May 13, 2003 Author Posted May 13, 2003 Thanks all - I will have a look at all your suggestions and I'm sure you have given me my answer! Many Thanks EddyB
EddyB Posted May 13, 2003 Author Posted May 13, 2003 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.
Peter Fenner Posted May 13, 2003 Posted May 13, 2003 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
EddyB Posted May 13, 2003 Author Posted May 13, 2003 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.
Peter Fenner Posted May 13, 2003 Posted May 13, 2003 Yes, portals literally open up a whole new window. Enjoy it Ed Pete
Recommended Posts
This topic is 7935 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 accountSign in
Already have an account? Sign in here.
Sign In Now