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

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

4.1K

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

correct answers 2 Correct answers

Community Expert , Jan 11, 2024 Jan 11, 2024

All item_id values in the dialog must be EXACTLY 4 characters long. No more, no less.

Votes

Translate

Translate
Community Expert , Jan 11, 2024 Jan 11, 2024

The name at item_id must be 4 characters long.

Votes

Translate

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

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

Copy link to clipboard

Copied

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

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

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

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

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

}

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

}

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

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

Copy link to clipboard

Copied

 

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

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

Copy link to clipboard

Copied

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

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
Community Beginner ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

Hi everyone,

I'm using a modified version of Mike345's code (four fields, different names) for my stamp script. I insert the custom stamp on a document and it works perfectly (triggers dialog, etc.) up to the point I hit "OK" or Enter: The fields on the stamp are not populated with those values I input, instead they all say "undefined". I'm using the latest Actobat DC. This is the modified code:

 

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

var ERETDlg1 = {

result: "cancel",

DoDialog: function() {

return app.execDialog(this);

},

pDeponente: "nDeponente",

pCaso: "nCaso",

pFecha: "nFecha",

pExhibit: "nExhibit",

initialize: function(dialog) {

var dlgInit = {

"nDeponente": this.pDeponente,

"nCaso": this.pCaso,

"nFecha": this.pFecha,

"nExhibit": this.pExhibit,

};

dialog.load(dlgInit);

},

commit: function(dialog) {

var oRslt = dialog.store();

this.pDeponente = oRslt["nDeponente"];

this.pCaso = oRslt["nCaso"];

this.pFecha = oRslt["nFecha"];

this.pExhibit = oRslt["nExhibit"];

},

description: {

name: "ERET 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: "Deponente",

},

{

type: "edit_text",

item_id: "nDeponente",

variable_Name: "pDeponente",

width: 131,

height: 23,

char_width: 8,

},

{

type: "static_text",

item_id: "sta2",

name: "Caso",

},

{

type: "edit_text",

item_id: "nCaso",

variable_Name: "pCaso",

char_width: 8,

},

{

type: "static_text",

item_id: "sta3",

name: "Fecha",

},

{

type: "edit_text",

item_id: "nFecha",

variable_Name: "pFecha",

char_width: 8,

},

{

type: "static_text",

item_id: "sta4",

name: "Exhibit #",

},

{

type: "edit_text",

item_id: "nExhibit",

variable_Name: "pExhibit",

char_width: 8,

},

]

},

{

type: "ok_cancel",

width: 64,

height: 23,

},

]

}, ]

}

};

ERETDlg1.pDeponente = "";

ERETDlg1.pCaso = "";

ERETDlg1.pFecha = "";

ERETDlg1.pExhibit = "";

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

this.getField("nDeponente").value = ERETDlg1.pDeponente;

this.getField("nCaso").value = ERETDlg1.pCaso;

this.getField("nFecha").value = ERETDlg1.pFecha;

this.getField("nExhibit").value = ERETDlg1.pExhibit;

}

 

Any suggestions? I recently read Thom's "All About PDF Stamps", but that's basically all I've read on the subject of PDF stamps. Thank you (or sorry) in advance.

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
Community Expert ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

All item_id values in the dialog must be EXACTLY 4 characters long. No more, no less.

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
Community Expert ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

And there's no need to define them for static texts...

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
Community Expert ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

The name at item_id must be 4 characters long.

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
Community Beginner ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

LATEST

Thank you! That was it.

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
Community Beginner ,
Jan 11, 2024 Jan 11, 2024

Copy link to clipboard

Copied

Thank you so much! Problem solved.

 

Updated code for reference:

 

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

var ERETDlg1 = {

result: "cancel",

DoDialog: function() {

return app.execDialog(this);

},

pDeponente: "nDep",

pCaso: "nCas",

pFecha: "nFec",

pExhibit: "nExh",

initialize: function(dialog) {

var dlgInit = {

"nDep": this.pDeponente,

"nCas": this.pCaso,

"nFec": this.pFecha,

"nExh": this.pExhibit,

};

dialog.load(dlgInit);

},

commit: function(dialog) {

var oRslt = dialog.store();

this.pDeponente = oRslt["nDep"];

this.pCaso = oRslt["nCas"];

this.pFecha = oRslt["nFec"];

this.pExhibit = oRslt["nExh"];

},

description: {

name: "ERET 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: "Deponente",

},

{

type: "edit_text",

item_id: "nDep",

variable_Name: "pDeponente",

width: 131,

height: 23,

char_width: 8,

},

{

type: "static_text",

item_id: "sta2",

name: "Caso",

},

{

type: "edit_text",

item_id: "nCas",

variable_Name: "pCaso",

char_width: 8,

},

{

type: "static_text",

item_id: "sta3",

name: "Fecha",

},

{

type: "edit_text",

item_id: "nFec",

variable_Name: "pFecha",

char_width: 8,

},

{

type: "static_text",

item_id: "sta4",

name: "Exhibit #",

},

{

type: "edit_text",

item_id: "nExh",

variable_Name: "pExhibit",

char_width: 8,

},

]

},

{

type: "ok_cancel",

width: 64,

height: 23,

},

]

}, ]

}

};

ERETDlg1.pDeponente = "";

ERETDlg1.pCaso = "";

ERETDlg1.pFecha = "";

ERETDlg1.pExhibit = "";

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

this.getField("nDep").value = ERETDlg1.pDeponente;

this.getField("nCas").value = ERETDlg1.pCaso;

this.getField("nFec").value = ERETDlg1.pFecha;

this.getField("nExh").value = ERETDlg1.pExhibit;

}

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