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

create a multi-line dialog box in a dynamic stamp

Community Beginner ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

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!!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

2.4K

Likes

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 ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

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.

Likes

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 Beginner ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

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

Likes

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 ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

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

Likes

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 ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

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

Likes

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 ,
Mar 07, 2019 Mar 07, 2019

Copy link to clipboard

Copied

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

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 Beginner ,
Mar 11, 2019 Mar 11, 2019

Copy link to clipboard

Copied

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;

}

Likes

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 ,
Sep 29, 2021 Sep 29, 2021

Copy link to clipboard

Copied

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;

}

Likes

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 30, 2021 Sep 30, 2021

Copy link to clipboard

Copied

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.

Likes

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 ,
Oct 01, 2021 Oct 01, 2021

Copy link to clipboard

Copied

 

Likes

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 ,
Oct 01, 2021 Oct 01, 2021

Copy link to clipboard

Copied

This is not a valid Acrobat stamp. What happened to the first page? There's supposed to be a first blank page in each stamp Adobe creates.

Likes

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 ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

LATEST

The field names used in the code are incorrect.

In the code you use "txt1", "txt2" etc. but the names of the fields on the stamp are different. The names in the code must exactly match the names of the fiels on the stamp.

 

 

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

Likes

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