Skip to main content
October 14, 2022
Question

Dynamic Stamp - Setting Dialog Box Defaults

  • October 14, 2022
  • 1 reply
  • 580 views

I found how to set the defaults in a stamp dialog box for text boxes, dropdown boxes, and check boxes, but I cannot find out how to set a default for a radio box.

 

For instance, in the code block below, it's easy to see how the textboxes and dropdown list will have their defaults set. But I have no idea how to do it for the radio boxes. Does anybody know the syntax for this?

var builder = {
    // These map to Text Fields in the Stamp
    textBoxes: [
        { field: "Name", description: "Name:", default: function() { return ""; } },
        { field: "Company Name", description: "Company Name:", default: function() { return ""; } },
    ],
    // This maps to a Popup Group in the PDF named 'Project'
    popupGroup: "Plan Section",
    listItems: [{
        popupItems: {
            //list of items of Popup menu, positive number indicates default selection
            "Civil": +1,
            "Struct": -1,
            "Arch": -1,
            "MEP": -1
        }
    }],
    // This maps to a Radio Group in the PDF named 'Status'
    radioGroup: "Type of Plans",
    radioButtons: [
        // value maps to the 'Choice' of each radio button in the group, description will show on the dialog
        { value: "", description: "Original Plans" },
        { value: "Revised Plans", description: "Revised Plans" },
        { value: "As-Built Plans", description: "As-Built Plans" }
    ],
    radioErrorMsg: "Please select a status"
}

  

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
October 14, 2022

This isn't dialog box code.  It's a data structure someone designed for a tool that creates the actual dialog box code. To find out how this structure is used to set a radio button default, you need to ask whoever developed the tool.  Where did you get it?

 

A better tool for generating dialog boxes is AcroDialogs:

https://www.pdfscripting.com/public/ACRODIALOGS-OVERVIEW.cfm

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
October 14, 2022

These forums. Any time anyone is asked where they got it, they say they found it somewhere else in the forums as an example.