Code Won't let me submit to dataset with code that adds 1 to existing value in Text input (Generated from database)

I am looking for help trying to figure out why when I try to submit a custom form to a database, code that takes an existing text input value generated from database entry and adds 1 to it won’t submit. If I do it manually it will, but when the code generates it, it won’t. Screenshots are below.

this first one if you click the left blue button, it will add 1 to the number in the white input box.

here it shows the green bar at bottom that submission was successful

but look at the number under miter saw, it is still the same. I added one to it, although it doesn’t show in screenshot.

Here is my code for adding one.

export function add1_mouseIn ( event ) {
let count = $w ( ‘#input4’ ). value ;
$w ( ‘#add1’ ). onClick ( ()=> {
count ++;
$w ( ‘#input4’ ). value = count . toString ();


This is code for clicking submit.

export function submit_click () {
var register = $w ( ‘#input4’ ). value ;
var registered = $w ( ‘#input2’ ). value ;

if ( register <= registered ) {
setTimeout ( function () { $w ( “#dataset1” ). save ();}, 2000 );
setTimeout ( function () { $w ( “#dataset1” ). refresh ();}, 2000 );
$w ( ‘#button1’ ). show ();
$w ( ‘#loading’ ). show ();
else {
$w ( ‘#button2’ ). show ();


Thanks in advance!

I’ve been doing this now for some 4 years, and I am getting a bit sick and tired of people asking the same bloody question over and over again, not reading the docs, not searching the forum, not even reading the “Similar posts” at the right hand side which will lead them to the answer.

I understand what you are saying and agree completel. I did refer to the side posts but they did not work for me. this is my fourth year as well, and I have a fairly complex system of databases and JavaScript going, but I just had a problem with a small area of code.

By the way, I searched extensively through the forums, and have a fairly good understanding of the documentation and API references.

And excuse my French.

i saw this before and am trying to add 1 to the number that is in the database and is displayed currently in the text input box. I have tried several methods but none of them have worked. Do you have any ideas of how to implement this with the code that you referenced to in the api?

@giri-zano not a problem :slight_smile:

From :value - Velo API Reference -

If an element is connected to a dataset, setting the element’s value in code does not set the value of the connected field in the dataset. That means if you use the dataset to perform a submit, the value changed in code is not reflected in the submitted item.

To submit the new value using a dataset, set the field’s value using the setFieldValue() function before performing the submit.

I will look into that tomorrow morning. Thanks so much for your help. I will still be hauling with the adding 1 onto existing but will try

I completely missed that application of it! I apologize, I must have not read it carefully. Thanks for the help!