Copy link to clipboard
Copied
New to writing JavaScript.
ContractRateBook will have a 3-digit number coming form my database.
Read somewhere that I need to use event.value but not sure how.
Came up with this but not working.
Theft is the name of my Checkbox
var x = this.getfield("ContractRateBook").value;
if (x == 103)
{event.value = 0;
getField("Theft").checkThisBox(0,true);}
Thanks.
Pat
Copy link to clipboard
Copied
When you say the value is coming from your database, do you mean you import it directly into the field? If so, how?
Copy link to clipboard
Copied
Yes.
Once I save the document with proper Form Field Names, I upload it to my Contract Tracking software where the Field Names automatically pull data from the software’s database.
I then run the document from within the software and it prints with the data in the fields.
Thanks.
var x = this.getfield("ContractRateBook").value;
if (x == 103)
{
event.value = 15;
getField("Theft").checkThisBox(0,true);
}
else
{
event.value = 0;
getField("Theft").checkThisBox(0,false);
}
[Private info removed. -Mod.]
Copy link to clipboard
Copied
OK, then you can use this code as a doc-level script:
var x = Number(this.getField("ContractRateBook").value);
if (x == 103) this.getField("Theft").checkThisBox(0,true);
(Note that when you reply by email it includes your personal details in the signature. You might want to avoid that...)