Javascripting Adobe: Adding +1 based off another field?
So, I'm trying to create a self-calculating form in adobe acrobat to make my life and the lives of others a bit easier (also I've seen other people make them and it looks like a pretty neat skill to have). My problem is I have no idea how to javascript or program, and I need to use javascript to make this form do what I want.
So instead, I've started to teach myself the basics of javascript to create calculating forms, but I've gotten stuck on a couple of fields that I'm not sure how to solve. So here's my code so far:
var mf = this.getField("field1") ;
if (mf.value > 0 && mf.value < 😎 {
event.target.value = [+0] ;
} else {
if (mf.value >= 8 && mf.value ) {
event.target.value = [+1] ;
} else {
event.target.value = [+0] ;
}
}
What I want this calculating form to do is: When a user inputs a number of 8 or more in field1, then field2 gets a +1. Just once. If field1 goes below 8, the +1 in field2 goes away. So tried to implement that. One time, field2 started adding +1 every time field1 is updated (really?) or it'll reset field2 to 1 if field1 is ever changed (just No).
I think what I really need at this point is some outside help from someone who knows how this stuff works. Is there anyone who could tell me what I'm doing wrong?
