• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Please help! How so I set up a fillable pdf so that checking one box, opens up a signature field?

New Here ,
May 17, 2024 May 17, 2024

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.

TOPICS
Acrobat SDK and JavaScript

Views

280

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 17, 2024 May 17, 2024

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"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 21, 2024 May 21, 2024

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:

  1. Open your PDF form in Adobe Acrobat Pro.

  2. Select the radio button field that allows users to select one of the two options.

  3. Go to the "Properties" panel for the selected radio button field.

  4. In the "Options" tab, make sure each radio button option has a unique name (e.g., "Option1" and "Option2").

  5. Go to the "Actions" tab and select "Mouse Up" as the trigger.

  6. Click the "Add" button to create a new action.

  7. Choose "Run a JavaScript" as the action.

  8. In the JavaScript editor, enter the following code:

 

javascript
Copiar código
if (this.getField("Option1").value == "Yes") { this.getField("SignatureBox").display = display.visible; } else { this.getField("SignatureBox").display = display.hidden; }
 

Replace "Option1" with the name of the first radio button option and "SignatureBox" with the name of your signature field.

  1. Click "OK" to save the action.

  2. 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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 23, 2024 May 23, 2024

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 23, 2024 May 23, 2024

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"

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 24, 2024 May 24, 2024

Copy link to clipboard

Copied

Verify the field names:

  • Make sure the name of the radio button is exactly "Option1".
  • Make sure the name of the signature field is exactly "SignatureBox".

 

Correct any typographical errors: The code must be properly formatted with braces {} and semicolons ; where necessary.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2024 May 24, 2024

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 24, 2024 May 24, 2024

Copy link to clipboard

Copied

LATEST

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. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines