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