Skip to main content
Participating Frequently
May 29, 2024
Question

Adobe stamp with Javascript form, check a checkbox !

  • May 29, 2024
  • 1 reply
  • 753 views

I need to check a checkbox in my stamp, throught my form in Javascript.


I have tried all of this so far :

 

var f = this.getField("checkBoxStatus");

      f.checked = true;

 

this.getField("checkBoxStatus"),value = “Yes”;
this.getField("checkBoxStatus"),value = “On”;

 

this.getField("checkBoxStatus").isBoxChecked(1);

 

this.getField("checkBoxStatus").checkThisBox(0,true);

It's my first time trying that so I'm looking throught Internet but I can't find the right way!

 

Thanks for your help!

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
May 29, 2024

So, there are several errors in the code.  For exampel, there is no "checked" property, and there are syntax errors on the other lines. 

But the first thing you need to do is read about creating dynamic stamps.

https://acrobatusers.com/tutorials/creating-a-custom-dynamic-stamp-infographic/index.html

 https://acrobatusers.com/tutorials/dynamic_stamp_secrets/index.html

 

The first level of the UI in the articles is old, but everything else is correct. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
May 29, 2024

Thanks Thom, I will check that out.   I'm used to code in .net so it doesn't came to my mind that there is no checked property for a checkbox!

Thom Parker
Community Expert
Community Expert
May 30, 2024

Well then, it's a good idea to look over the Acrobat JavaScript Reference.  You'll find lots of important information here:

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/toc.html

 

And here's an article on now checkboxes work in Acrobat scripting:

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

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