Can't increment a record by 1

Wappler Version : 5.8.2 Stable
Operating System : MacOS
Server Model: PHP
Database Type: MySQL
Hosting Type: Shared/MAMP

Expected behavior

What do you think should happen?

I have a hidden input that I get a value from a database field and I want to increase that value by 1. If database value is equal to 2 it should have an input value of 3.

<input class="form-control form-control-sm" id="hiddenAddToJFCSeatCount" name="hiddenAddToJFCSeatCount" aria-describedby="input1_help" dmx-bind:value="(jobfindclubs_selected.data.query.jfc_available + 1)">

Actual behavior

What actually happens?

It shows a value of 21. It is appending the 1 n to the end rather than adding to the value.

I have also tried doing this on the actual form update API as well with the same result. Subtracting a value of 1 works as it should - just not adding.

dmx-bind:value="(jobfindclubs_selected.data.query.jfc_available - -1)"

Above will actually increment by 1 so that is what I have done temporarily.

Most probably this is type of string, so you have to apply the toNumber formatter before doing the +1 :slight_smile:

lol, converting to number first did indeed work. Sheesh. Thanks! Don’t know why I didn’t think of that. Maybe I need :beers:?

So why does subtraction work without converting to number but addition doesn’t? Just curious.

JavaScript is a weird animal :slight_smile:

2 Likes