Skip to main content
James_Willoughby
New Participant
July 18, 2023
Solved

Click checkbox to add, uncheck checkbox to minus

  • July 18, 2023
  • 3 replies
  • 1823 views

I have a total and I have a list of numbers. If I click a check box next to the number, I want to add this to the total.
I can do this with variables, but if I click the checkbox again it keeps adding to the total.
How can I set it so that when I uncheck the checkbox the number is subtracted from the total?

This topic has been closed for replies.
Best answer by Edwart

Hi @James_Willoughby

You can achieve this by creating a checkbox component and add the logic to this component. When the checkbox is unchecked and it gets clicked, you add one to the count and change the variant to “checked”.

On this variant add the following behaviour: when the checked checkbox is clicked, subtract one from count and change the variant to “unchecked”.

3 replies

Edwart
EdwartSolution
July 18, 2023

Hi @James_Willoughby

You can achieve this by creating a checkbox component and add the logic to this component. When the checkbox is unchecked and it gets clicked, you add one to the count and change the variant to “checked”.

On this variant add the following behaviour: when the checked checkbox is clicked, subtract one from count and change the variant to “unchecked”.

James_Willoughby
New Participant
July 18, 2023

Bloody hell, I was way overcomplicating that, thanks!!

February 28, 2024

Certainly! Here’s a translated version of your request in English:


I would like to inquire about implementing a checkbox component with a specific requirement. When the checkbox is unchecked and clicked, I need to add different values each time.

Could you please guide me on how to implement this?