Skip to main content
Participant
October 23, 2024
Answered

add1 to a field by clicking a button

  • October 23, 2024
  • 1 reply
  • 516 views

 

Hello,

 

I m trying to do a JS code, and i m completly new to this.

 

I'd like to add 1 in a field by clicking on a button.

 

How can i do that?

 

Sorry i guess it s really easy but i don t know anything about javascript..

 

Thanks!

This topic has been closed for replies.
Correct answer try67

var f = this.getField("Text1");

f.value = Number(f.value)+1;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 23, 2024

var f = this.getField("Text1");

f.value = Number(f.value)+1;

Participant
October 23, 2024

thanks,

 

but it doesn't work. I change the "Text1" by the name of the field. but the field stay at 0

try67
Community Expert
Community Expert
October 23, 2024

Check the JS Console for errors.