Add number value to database based on button select

Hi, I have a group of buttons on a “vehicle booking” form which can be selected as extras when a booking is made. The problem i have is that i need these to somehow translate to £ amounts when they are sent to the database. for example when “Collection (£50)” is selected and then the vehicle booking is saved we need the amount £50 to be added to the “collection” field in the database/booking. This amount will then be used when we generate invoices etc. each of these buttons has a state currently which is used to change the button colour when this button is selected, im not sure if there is someway to base the entry on weather or not the state is Yes/No. So when X button state is yes, entry = £50.

Hi Tom!

The best way to handle this would probably be with an option set and a repeating group, which may require redesigning your interface slightly if you currently have it set up as separate elements.

Here’s a quick video walkthrough of what I’m thinking:

Let me know if I misunderstood your question in some way!

1 Like

This is brilliant!!, all understood and opened my eyes to a new feature i wasn’t even aware of (Attributes in potion sets). FYI, i was using individual buttons rather than a RG so this way is much more efficient.

Thanks again for the video

My pleasure, Tom. Glad this video was helpful for you!

hey sam, dont suppose you can help with this, i have spent about and hour messing about my self.

is it possible to set the states of the buttons we creadted to default to “yes” if the “Extra” is present in the data base. So when a user goes in an out of a file the buttons will still be blue. I have currently set a conditional format to change the colour to the dark blue if the “vehicle booking extra matches current cells display”. the only issue with this, and it is a small issue, is that the state of that button defaults to NO when you visit the page, so if i then wish to remove one of the those options i have to click the button twice. So once client sets the state to yes, so it stays the same dark blue colour based on the first condition we setup for the colour change, and then the second click changes it back to no so it is then removed from the database and as such the second condition i setup doesn’t detect it and so the colour remains grey.

So just trying to overcome having to click twice which feels a bit buggy.

hope that makes sense


Hey Tom!

Really great question - in order to leverage default values from the database, we’ll want to change up the way that we’re storing the “selected options” - since a yes/no state on a button element within a repeating group cell isn’t accessible from outside of the repeating group, I think it would be a better set up to have a custom state on the repeating group itself that stores a list of selected options.

Here’s a video walkthrough for you:

Let me know if you have any questions!

1 Like

perfect - thanks

one final thing, where do i then set my conditions for the colours, on the button itself or on the repeating group?

On the button itself, but the condition should refer to the state on the repeating group :slight_smile:

1 Like