Copy link to clipboard
Copied
Trying to finish up a fillable pdf and am stuck on this last bit. Have a radio box where you can select one of 2 options, and need to get a signature box to appear when 1st radio option is selected.
Copy link to clipboard
Copied
As Mouse UP action of checkbox, use this:
if(event.target.value != "Off")
this.getField("Signature1").display = display.visible;
If you need something more complex to hide a field if the checkbox is unchecked, you can use calculate script in any text field (in that case remove the above script if you added it)
var check = this.getField("Check Box1").value;
var sig = this.getField("Signature1");
sig.display = (check == "Off") ? display.hidden : display.visible;
Change "Check Box1" to your actual name of checkbox that will show/hide signature field.
Change "Signature1" to your actual name of the signature field.
In case you have mutually exclusive checkboxes:
let's say export value of the checkbox that control signature field display is "Yes", in the calculation script
change: == "Off"
to: != "Yes"
Copy link to clipboard
Copied
To achieve this in a fillable PDF, you'll need to use JavaScript. Here's a step-by-step guide on how to accomplish it:
Open your PDF form in Adobe Acrobat Pro.
Select the radio button field that allows users to select one of the two options.
Go to the "Properties" panel for the selected radio button field.
In the "Options" tab, make sure each radio button option has a unique name (e.g., "Option1" and "Option2").
Go to the "Actions" tab and select "Mouse Up" as the trigger.
Click the "Add" button to create a new action.
Choose "Run a JavaScript" as the action.
In the JavaScript editor, enter the following code:
Replace "Option1" with the name of the first radio button option and "SignatureBox" with the name of your signature field.
Click "OK" to save the action.
Save your PDF form.
Now, when the user selects the first radio button option, the signature box should appear, and it should disappear when the second option is selected.
Remember to test your PDF form to ensure that it behaves as expected.
Copy link to clipboard
Copied
Hello,
I tried that code but it is sayiError: missing ; before statement 2: at line 3". I have tried to put the semi colon in a few different spots but am not getting any luck. Would you know how to correct this? Thanks!
Copy link to clipboard
Copied
Looks like I had a typo^ The error message I am getting says "SyntaxError: missing ; before statement 2: at line 3"
Copy link to clipboard
Copied
Verify the field names:
Correct any typographical errors: The code must be properly formatted with braces {} and semicolons ; where necessary.
Copy link to clipboard
Copied
I just tried this and I am getting the same SyntaxError message. I copy and pasted exactly how you typed it. Is there a semicolon missing somewhere in the code? That is what the Syntax Error message is saying. Thanks!
Copy link to clipboard
Copied
The syntax error is probably because you included "Copiar código" in the your code. This is just text and not part of the script. Only include these lines:
if (this.getField("Option1").value == "Yes"){
this.getField("SignatureBox").display = display.visible;
} else {
this.getField("SignatureBox").display = display.hidden;
}
You should have just used to code provided by Nesa.