Currently, there is an option to change the "hover color" on button components. Is there an option to change the color once the button is selected? In my current dashboard, we have multiple buttons and it would be nice if the button a user selects would change colors, then it is apparent they are on that button.
Solved! Go to Solution.
First, define the backgroundcolor of your button with something like this : "... BackgroundColor = XFBR(YourBusinessRuleName, YourFunctionName, variable1 = YourVariable) ..."
YourVariable, most likely, could be a parameter that will be set to "true" when you click on your button.
Then, play around with this code in YourBusinessRuleName XFBR below. It will have darkblue color if true, black if false.
If (args.FunctionName.XFEqualsIgnoreCase("YourFunctionName")) Then
' Get the variable :
Dim str_variable1 As String = args.NameValuePairs("Variable1")
' Initiate the output :
Dim buttonColor as string = Nothing
If str_Variable1 = "True" Then
buttonColor = "XFDarkBlueBorder"
buttoncolor = "XFBlack"
I was looking into this post because I'm working on a dashboard and I'm trying to create a functionality that changes the background of a button when it's clicked.
I followed what was suggested here, but there is something that's not clear to me.
As you suggested, in the formatting section of the button I added the XFBR line
BackgroundColor = XFBR(BusinessRuleName, Function2, variable1 = YourVariable)
When the button is clicked by the user, a Function (let's call it Function1) in the BR BusinessRuleName is triggered and it performs a specific task, while at the same time it updates the parameter value to True (in you example the parameter was YourVariable).
Then I created another Function (Function2, the one that I placed within the formatting section of the button), which picks up the value of the parameter YourVariable and it returns a different background color based on whether the parameter value is set to True or False.
Summing up, within the BR I have 2 functions:
Function 1 performs a task when the button is clicked, and it updates the value of the parameter YourVariable.
Function2 retrieves the value of YourVariable and returns a background color.
The problem is, Function2 never gets triggered, when the user clicks on the button only function 1 gets triggered. Am I doing something wrong, or is there something that I am missing?
Thanks in advance for any help!