Forum Academy Marketplace Showcase Pricing Features

[SOLVED] Need help in changing quantity input field with button per click


Can someone try to see whats wrong with the code?

When i change the input field then the “+” or "- " quantity button sometime work, sometime not working.

I had try to debug, the quantity seem correct. but sometime it wont show up in the input field when i click “+” or “-” icon.

project link:

Any help is appreciated!

Hello :slight_smile: I just changed the setup a little bit so that the quantity is updated when a + or - icon is clicked. Previously you had the workflows for the plus and minus buttons to display data in the parent group of the input, and then had a separate workflow which updated the custom state when the input’s value changed. I think this method might work but it is easier to have the icons directly set the custom state on the input itself, and (change) the input’s value. To do this I just used the custom state you created on the Input called “SavedValueChanged”, with these workflows:

When the minus button is clicked, the workflow is:

When the plus button is clicked, the workflow is:

And then I just set another workflow which occurs on page load (to set the quantity to 0):

1 Like

Appreciated your input, but still, the “+” and “-” function will not be function anymore if user manually change the input field to any amount.
For example, if he change to quantity 10 then he click button “+” the input field should become 11 instead it does nothing for this case. :disappointed_relieved:

Ohh I see. :slight_smile: I just added this workflow as well then:

“Do When Condition is True” (Every Time) --> When Input Quantity’s SaveValueChanged is not Input quantity’s value -->

This way, any time a User changes the value in the input, it adjusts the custom state to be the value that the User entered. Then that value can still be adjusted using the plus and minus buttons.


I just tried , seem like its still broken , right ?

You’re right - I’m not sure why I thought that method worked before! Hmm. I will keep testing a few things.

1 Like

Ok got it! (I think! :slight_smile: ) I just added an action to reset the value of the input. That seems like it would go to zero, but it actually resets it to the value of the custom state - which is the number the User just entered.

1 Like

Hi thanks, but the button still buggy(stop working) if user click too fast after changing the input value. Anyways, i think i will just remove the button, thanks! :relaxed:

Edit: work like charm now after adding reset data on both button workflow . Thanks!