Jump to content
Sign in to follow this  
Karen2

Script to show/hide fields

Recommended Posts

I'd like to create a button to show/hide fields in a database. I've searched the forum, but could only find conditionals using radio buttons and such.

I want to be able to click on a "+" button to show the fields and "-" button to hide the fields. I'm not sure if these buttons should be based on a script or portal.

I appreciate any help you can give!

Karen

Share this post


Link to post
Share on other sites

The easiest method would be to have another layout without those fields and just have buttons that switch back and forth between the two layouts.

If that is not feasible then here are some other threads you can take a look at.

Visibility Methods

Visibility Link 2

Share this post


Link to post
Share on other sites

What would be the purpose of this? Normally, a "+" button signifies 'add another one of the same kind'. In Filemaker, that would - in most cases - mean 'add another related record', not 'show another field'. For this, you would use a portal, and you could use "+" and "-" buttons to add/delete related records.

Share this post


Link to post
Share on other sites

OT:

i think like this even though not a FM trick, view the photo on my site, and click the green lock on the left to show hide details

Link

Share this post


Link to post
Share on other sites

I think John's reply covers exactly this type of situation. In version 8 and above, you would probably use a tab control object for this.

Share this post


Link to post
Share on other sites

karen

look at the attached file. The hide and seek of the menu is done with a portal. look at the relationship and the fields. Press the menu button for the menu to appear and press it a second time and the menu disappears. The file is a FM version 6 file.

I hope this works for you.

Lionel

hideandseek.zip

Edited by Guest

Share this post


Link to post
Share on other sites

I guess I'm too new to this forum...I can open the zipped files but cannot touch them, as it says I do not have access.

Robert: I clicked on the link to your website and that is exactly what I want to do! Now, how did you do it :)

Thank you all so much for your replies!!

Karen

Share this post


Link to post
Share on other sites

Karen

You will need to add three field to your database

1)Menustatus (text field)

2) Condcalc is a calculation field.

case [isempty(Menustatus;" ","1"]

3) Constant is a calculation field = "1"

Make a self join relationship between the fields as

Condcalc = Constant

Make a portal using this relationship and install the fields you want to hide or show.

Add this script to a button for the hide and seek

If[Menustatus = 1]

set field [Menustatus," "]

else

set field (Menustatus, "1"]

end if

This will bring forth the fields with the button is press and hide the fields again when the button is press again or you can automatic it to hide the fields upon exiting with an exit script.

Hope this helps

Lionel

Edited by Guest

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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