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.

Changing layout color by field entry

Featured Replies

I would like to change the background color in my contacts database to reflect if someone has died, i.e. when the radio button for Deceased? is marked Yes then the background colors would change to grey or black.

Is this possible?

There are several ways to do this but the most straightforward method is to store your background swatch in a global container field. Just draw a small rectangle in layout mode with the color background you want. It can be as small as 1 pixel by 1 pixel if you want. Cut the rectangle from the layout to the clipboard. Enter browse mode and paste the swatch into the global container field. You don't need to display the global field on any layout. Then, create a calculation with the following formula:

Case(RadioButton = "Deceased"; GlobalContainerField)

Place the calculation field on the layout where you want the background displayed and make it as large as the entire layout area. Make sure to set the field to not allow entry in browse or find mode via the Field Behavior dialog. Also, make sure you send the calculation field to the back of all the other objects. Finally, with the calculation field selected, choose Graphic... from the Format menu and set it to Enlarge and uncheck the option to "maintain original proportions".

  • Author

That is SO COOL!

In my database your formula was actually Case(Deceased = "Yes"; BackgroundColor) because that is how I set up the fields. I include that because it might help clarify for others who are checking this out.

Thank you very much.

  • Author

What if I wanted the background color to be changed by more than one thing?

For instance:

radio button- Deceased (Yes, No) Grey

drop down- Category (Alumnus, Friend, Family) Red, Green, Brown

Of course deceased grey should take priority over the other colors.

How could I do that?

Make your global container field a global container with as many repetitions as you want background colors. Paste the swatches into the different repetitions of the global field and then change your formula to something like this:

GetRepetition(

xGlobalContainerRepeatingField;

Case(Category = "Alumnus"; 1; Category = "Friend"; 2; 3)

)

This topic has come up many times in the past. Take a look at this post change background color, and the sample file by CobaltSky

Lee

  • Author

I think I must be doing something wrong- the container field I created, and then put a color into each repetition. I then resized it and made it into my background but the other colors were still present to the right. There must be a place where I choose only to view one repetition at a time, right?

The calculation did not change anything probably because of the set up of the container field...

As in the example from the other post, I changed the field setup to display 1 repetition. The calculation does not work yet though.

  • Author

Aha! I had put the container field in the background instead of the calculation field- then changed the Graphic... to Enlarge. Now it works!

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.