JavaScript Checkbox
Copy link to clipboard
Copied
I have a text feild "ONLY IF NO" i want to populate with text from another field "NWA FULL NAME" only if a specific checkbox is checked. I have tried many different methods and believe i am close. The blow script gives me a syntax error missing ) after argument list 1: at line 2. No matter where i place the ) same result. Any advice on how to fix this or possibly a different method?
I am placing the below script into the checkbox:
var INPUT = this.getField(“ONLY IF NO).value;
var APPL = this.getField(“NWA FULL NAME).value;
this.getField(“ONLY IF NO”).value = APPL;
Copy link to clipboard
Copied
Use "ONLY IF NO" in the first line and "NWA FULL NAME" in the second line.
Copy link to clipboard
Copied
Maybe I am over thinking this but that is what I did.
Copy link to clipboard
Copied
In your script you use "ONLY IF NO and "NWA FULL NAME
Copy link to clipboard
Copied
You have a couple of different errors. First, strings must be completely inclosed in quotes. The first two lines are missing the closing quotes. But, the quote characters are wrong. You must use only ASCII characters for JavaScript code. It looks like this code was edited or copied from a word processor.
You did not say in which event the script is placed. Please proivide this information.
After you fix the syntax errors I'll tell you how to change the code so it works.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Apologies I am not well versed in using any form of Script and yes I did copy that from a word processor. Thank you for pointing me to the reference. As far as events I believe it will be a MouseUp event. Again, I am new to thins and have had no formal training. Apprecitate the assist.
Copy link to clipboard
Copied
Where does you set APPL?
Copy link to clipboard
Copied
Ah I see the error. Thank you.
Copy link to clipboard
Copied
As 'Mouse UP' event of checkbox use this script:
var INPUT = this.getField("ONLY IF NO");
var APPL = this.getField("NWA FULL NAME").value;
INPUT.value = event.target.value == "Off" ? "" : APPL;

