I have a number input field. I also have a button. When the button is clicked, I want the input field to go up by 1. So now it is 0. If I hit the button 3 times, then the value should show 3.
On the button, I put a dynamic event -> Mouse -> OnClick.
So it says: dmx-on:click=“form1.input1.setValue(+ 1)”
This works the first time, but not after that. It stays 1.
If I try form1.input1.setValue(input1.value + 1) it concatenates the 1s.
form1.input1.setValue(input1.value.toNumber() + 1) just sets it to 1 when you click but doesn’t go any higher.
Any ideas on what my blind brain isn’t realizing here?
Because this is prettier. Actually, because this platform will be used most often on tablets and smartphones. With that in mind, this type of change would be more efficient while in the field. I am keeping it stupid simple for the user, and allowing them to change quantity by either method. Plus, it the additional method of the buttons is non-obtrusive.
Likewise, same code although i’m not sure if there was an issue surrounding the stage of adding the 1, make sure you select number and not text as initially i had problems and this seemed to be related.
@TomD@Hyperbytes, I got it to work. For some reason, it was taking out everything I was doing and just putting form1.input1.setValue(+1) instead of what I was putting. I have had that happen a couple other times. I wish I could find what makes it overwrite what I put in and what doesn’t. Thanks!
Its when you make the change and then excitedly push cmd+s without clicking out of the field to make it actually take or hitting tab or enter.
I have done it a few times too expecting that somehow Wappler is so smart that it just knows I have finished typing my expression and on save it must enter the alteration as well as save the document.