Skip to main content
Mike345
Participant
March 7, 2019
Answered

create a multi-line dialog box in a dynamic stamp

  • March 7, 2019
  • 4 replies
  • 6546 views

Hi, this is day one working with this so I'll try to convey. I'm using Acrobat Pro. I made a dynamic stamp that has 5 user entered values and when you place the stamp it comes up with 5 different dialog boxes for each input. This is not user friendly. I'd like one dialog box to have all 5 lines displayed at the same time so that the user can see all before placing the stamp. Here's the script I'm using in 5 separate text fields:

var cAsk = "Enter The Job Number" ;

var cTitle = "Job #";

if(event.source.forReal && (event.source.stampName == "#8CQ7KDV9KiNCz8K-i8Cf8A"))

{

  var cMsg = app.response(cAsk, cTitle);

    event.value = cMsg;

  event.source.source.info.DocumentState = cMsg;

}

Hope this makes sense, thanks for any help!!

This topic has been closed for replies.
Correct answer Bernd Alheit

The name at item_id must be 4 characters long.

4 replies

Mike345
Mike345Author
Participant
March 11, 2019

Thank you to everyone for all the help! It took some time but I've got my stamp working the way I want it to. For anyone searching this same topic here's the code I have now. 5 user entered values in one pop up window. Cheers!

if (event.source.forReal && (event.source.stampName == "#8CQ7KDV9KiNCz8K-i8Cf8A"))

    var JSADMDlg1 = {

        result: "cancel",

        DoDialog: function() {

            return app.execDialog(this);

        },

        job: "txt1",

        specsection: "txt2",

        shopdwg: "txt3",

        submittaldate: "txt4",

        reviewedby: "txt5",

        initialize: function(dialog) {

            var dlgInit = {

                "txt1": this.job,

                "txt2": this.specsection,

                "txt3": this.shopdwg,

                "txt4": this.submittaldate,

                "txt5": this.reviewedby,

            };

            dialog.load(dlgInit);

        },

        commit: function(dialog) {

            var oRslt = dialog.store();

            this.job = oRslt["txt1"];

            this.specsection = oRslt["txt2"];

            this.shopdwg = oRslt["txt3"];

            this.submittaldate = oRslt["txt4"];

            this.reviewedby = oRslt["txt5"];

        },

        description: {

            name: "JSADM Dialog",

            elements: [{

                type: "view",

                width: 254,

                height: 351,

                elements: [{

                        type: "view",

                        width: 236,

                        height: 354,

                        char_height: 10,

                        elements: [{

                                type: "static_text",

                                item_id: "sta1",

                                name: "Job #",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt1",

                                variable_Name: "job",

                                width: 131,

                                height: 23,

                                char_width: 8,

                            },

                            {

                                type: "static_text",

                                item_id: "sta2",

                                name: "Spec. Section",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt2",

                                variable_Name: "specsection",

                                char_width: 8,

                            },

                            {

                                type: "static_text",

                                item_id: "sta3",

                                name: "Shop Drawing #",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt3",

                                variable_Name: "shopdwg",

                                char_width: 8,

                            },

                            {

                                type: "static_text",

                                item_id: "sta4",

                                name: "Submittal Date",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt4",

                                variable_Name: "submittaldate",

                                char_width: 8,

                            },

                            {

                                type: "static_text",

                                item_id: "sta5",

                                name: "Reviewd by",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt5",

                                variable_Name: "reviewedby",

                                width: 214,

                                height: 26,

                                char_width: 35,

                            },

                        ]

                    },

                    {

                        type: "ok_cancel",

                        width: 64,

                        height: 23,

                    },

                ]

            }, ]

        }

    };

JSADMDlg1.job = "";

JSADMDlg1.specsection = "";

JSADMDlg1.shopdwg = "";

JSADMDlg1.submittaldate = "";

JSADMDlg1.reviewedby = "";

if ("ok" == JSADMDlg1.DoDialog()) {

    this.getField("txt1").value = JSADMDlg1.job;

    this.getField("txt2").value = JSADMDlg1.specsection;

    this.getField("txt3").value = JSADMDlg1.shopdwg;

    this.getField("txt4").value = JSADMDlg1.submittaldate;

    this.getField("txt5").value = JSADMDlg1.reviewedby;

}

Participating Frequently
September 29, 2021

Hello, PLEASE HELP!!!

 

I have copied the script right above and used it for my 6 field fillable stamp I need to make. 

I have gotten it to a point where the dialog box pops up when I use the stamp, I can fill in all the information, but it does not populate the stamp when I hit OK. Also, the stamp will not work unless the stamp PDF file is open, which is not ideal.

 

This is the edited version currently sitting in a seperate text field on my stamp PDF...

 

if (event.source.forReal && (event.source.stampName == "#Bl4TRqavqXxv9oRx8napLD"))

var JSADMDlg1 = {

result: "cancel",

DoDialog: function() {

return app.execDialog(this);

},

JobNo: "txt1",

In: "txt2",

Out: "txt3",

Reviewed: "txt4",

Reviewedwithcomments: "txt5",

Resubmitseecomments: "txt6",

initialize: function(dialog) {

var dlgInit = {

"txt1": this.jobno,

"txt2": this.in,

"txt3": this.out,

"txt4": this.reviewed,

"txt5": this.reviewedwithcomments,

"txt6": this.resubmitseecomments,

};

dialog.load(dlgInit);

},

commit: function(dialog) {

var oRslt = dialog.store();

this.jobno = oRslt["txt1"];

this.in = oRslt["txt2"];

this.out = oRslt["txt3"];

this.reviewed = oRslt["txt4"];

this.reviewedwithcomments = oRslt["txt5"];

this.resubmitseecomments = oRslt["txt6"];

},

description: {

name: "JSADM Dialog",

elements: [{

type: "view",

width: 254,

height: 351,

elements: [{

type: "view",

width: 236,

height: 354,

char_height: 10,

elements: [{

type: "static_text",

item_id: "sta1",

name: "Job No",

},

{

type: "edit_text",

item_id: "txt1",

variable_Name: "jobno",

width: 131,

height: 23,

char_width: 8,

},

{

type: "static_text",

item_id: "sta2",

name: "In",

},

{

type: "edit_text",

item_id: "txt2",

variable_Name: "in",

char_width: 8,

},

{

type: "static_text",

item_id: "sta3",

name: "Out",

},

{

type: "edit_text",

item_id: "txt3",

variable_Name: "out",

char_width: 8,

},

{

type: "static_text",

item_id: "sta4",

name: "Reviewed",

},

{

type: "edit_text",

item_id: "txt4",

variable_Name: "reviewed",

char_width: 8,

},

{

type: "static_text",

item_id: "sta5",

name: "Reviewed with comments",

},

{

type: "edit_text",

item_id: "txt5",

variable_Name: "reviewedwithcomments",

char_width: 35,

},

{

type: "static_text",

item_id: "sta5",

name: "Resubmit see comments",

},

{

type: "edit_text",

item_id: "txt5",

variable_Name: "resubmitseecomments",

width: 214,

height: 26,

char_width: 35,

},

]

},

{

type: "ok_cancel",

width: 64,

height: 23,

},

]

}, ]

}

};

JSADMDlg1.jobno = "";

JSADMDlg1.in = "";

JSADMDlg1.out = "";

JSADMDlg1.reviewed = "";

JSADMDlg1.reviewedwithcomments = "";

JSADMDlg1.resubmitseecomments = "";

if ("ok" == JSADMDlg1.DoDialog()) {

this.getField("txt1").value = JSADMDlg1.jobno;

this.getField("txt2").value = JSADMDlg1.in;

this.getField("txt3").value = JSADMDlg1.out;

this.getField("txt4").value = JSADMDlg1.reviewed;

this.getField("txt5").value = JSADMDlg1.reviewedwithcomments;

this.getField("txt6").value = JSADMDlg1.resubmitseecomments;

}

try67
Community Expert
Community Expert
September 30, 2021

This indicates there's something quite wrong with how the stamp is set up. Please share the actual stamp file with us for help with this.

Thom Parker
Community Expert
Community Expert
March 7, 2019

You can find loads of info on Acrobat JavaScript dialogs here:

ACRODIALOGS OVERVIEW

At the bottom of the page is a link to a PDF with example dialog code in it.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Karl Heinz  Kremer
Community Expert
Community Expert
March 7, 2019

There was a discussion just a few days ago about the same subject with some useful information: Creating dynamic stamps

try67
Community Expert
Community Expert
March 7, 2019

You'll need to create a Dialog object with all five fields. This is not a simple task, at all...

You can read about it in under the execDialog method of the app object.

Mike345
Mike345Author
Participant
March 7, 2019

Do you know where there's an example I could see?

try67
Community Expert
Community Expert
March 7, 2019

In the documentation I mentioned above there are 3 examples, as well in multiple places on these forums... Try searching for "dialog object" or "execDialog".