Forum Academy Marketplace Showcase Pricing Features

Simple question about buttons in forms

I am trying to do a very simple thing
Please see the attached image
I build a simple form - and i want that when the user clicks on one of the buttons (SEE RED ARROW) - the background color of the chosen button will be green and when the user submits the form (red button) I can pass the chosen button to as a data.

If the user clicks on one button and then clicks on another button - the first button will be gray agian and the new clicked button will be green. (so there is only one option to choose)

Looks simple but not sure how to do it…

Hey @amitshemla :wave:

Thanks for the post! I love stuff like this and am happy to talk through it. There are probably a couple of ways you could tackle this, but here’s how I’d do it:

I would make the car options an option set and display them in a repeating group. That way, you design the button once and it’s applied equally throughout the RG. I’d add a custom state that stores the selected option and a conditional that changes the background color of the button if current cell’s option is custom state’s option. Past that, you’d just set a workflow on the button that sets the custom state to the current cell’s option whenever the button is clicked.

When the form is submitted, you’ll save whatever value is stored in the custom state.

Give it a try and don’t hesitate to email us directly with any questions: [email protected]

This topic was automatically closed after 70 days. New replies are no longer allowed.