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

Create Dynamic Stamp with Checkbox

New Here ,
Sep 25, 2024 Sep 25, 2024

Copy link to clipboard

Copied

I am completely new to dynamic stamps and have zero knowledge of javascript, but have managed to cobble together various javascript from google to create a Stamp with the date automatically populating : 

event.value = (new Date()).toString(); AFDate_FormatEx("h:MM tt dd/mm/yyyy");

 

And 2 empty fields that the user can input text (name and code): 

if (event.source.forReal && (event.source.stampName == "#hA4B5jvsuNXthXqaB8murC")) {
if ("ok" == app.execDialog(dialog1)) {
this.getField("Field1").value = dialog1.field1;
this.getField("Field2").value = dialog1.field2;
}
}

 

I would like to add 2 checkboxes to the stamp (Invoice and Credit Card) but I have no idea what javascript I need, or where to put the javascript to get the boxes to work.

 

Any help or advice would be very much appreciated.

 

Thanks

TOPICS
JavaScript , Modern Acrobat

Views

177

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 ,
Sep 25, 2024 Sep 25, 2024

Copy link to clipboard

Copied

LATEST

You can't just call app.execDialog(dialog1) without first defining dialog1.  You must build a dialog window iwith 2 text fields and two check boxes or radio buttons using JavaScript and assign the variable dialog1 to the dialog before executing it.  Popup dialogs are complicated to code.  You can start here:

https://opensource.adobe.com/dc-acrobat-sdk-docs/library/jsapiref/JS_API_AcroJS.html#dialog

Make the export values of the check boxes in your stamp true because the dialog check boxes or radio buttons return either true or false, depending on whether they are checked.

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