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!!
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.
Copy link to clipboard
Copied
Do you know where there's an example I could see?
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".
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
Copy link to clipboard
Copied
You can find loads of info on Acrobat JavaScript dialogs here:
At the bottom of the page is a link to a PDF with example dialog code in it.
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;
}
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;
}
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.
Copy link to clipboard
Copied
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.
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.