Changing button color based on value

Hi everyone, I’m looking into adding a feature to my app that allows a user to select between 3 options to set a value for an attribute. Based on the button they press, I want that button to appear green for example, and the others to appear white. I know about the radio button, I am just looking to add some extra style to the app. Does anyone know if this is possible. Thanks, Jon
2 answers

I recommend modeling 2 buttons for each option: one with the “selected” color, and other with the “unselected” color. Then use conditional visibility to show only one of the two options. So that’s 6 buttons total with 3 visible at any time.


Hi Jon,

1.Give class name to the buttons 
2.Call a Nanoflow in the button and add a Javascript action and pass the respective value as the input parameter to the Javascript action.
3.Get the class of the button using 'document.getElementsByClassName' and change the color of the respective button based on the selected value.