I've created a dynamic stamp with 6 text field entries that I've used Thom's PDFDialog program to create the entry for. I can't seem to get the data that is entered to show up on the stamp however.
Right now, I can pull the stamp up, it asks for the data input, and when I click "OK" it puts a blank stamp on the page. I've got the commit function in there, but it's not dropping it in...
The text form fields are "Text1", "Text2" etc...through "Text6".
I've placed the following code under the "Text1" calculation field...
Suggestions?/Reviews?/Glaring Problems?
------------------------------------------------
if(event.source.forReal && (event.source.stampName ==
"#pOICS6hZzCpkYB3pLSQzdD"))
var JSADMDlg1 =
{
result:"cancel",
DoDialog: function(){return app.execDialog(this);},
POSUB:"Text1",
PHASE:"Text2",
CC:"Text3",
H:"Text4",
COMMENTS:"Text5",
AMOUNT:"Text6",
initialize: function(dialog)
{
var dlgInit =
{
"Text1": this.POSUB,
"Text2": this.PHASE,
"Text3": this.CC,
"Text7": this.H,
"Text5": this.COMMENTS,
"Text6": this.AMOUNT,
};
dialog.load(dlgInit);
},
commit: function(dialog)
{
var oRslt = dialog.store();
this.POSUB = oRslt["Text1"];
this.PHASE = oRslt["Text2"];
this.CC = oRslt["Text3"];
this.H = oRslt["Text7"];
this.COMMENTS = oRslt["Text5"];
this.AMOUNT = oRslt["Text6"];
},
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: "PO/Subcontract #",
},
{
type: "edit_text",
item_id: "Text1",
variable_Name: "POSUB",
width: 131,
height: 23,
char_width: 8,
},
{
type: "static_text",
item_id: "sta2",
name: "Phase",
},
{
type: "edit_text",
item_id: "Text2",
variable_Name: "PHASE",
char_width: 8,
},
{
type: "static_text",
item_id: "sta3",
name: "Cost Code",
},
{
type: "edit_text",
item_id: "Text3",
variable_Name: "CC",
char_width: 8,
},
{
type: "static_text",
item_id: "sta4",
name: "Hold Invoice?",
},
{
type: "edit_text",
item_id: "Text4",
variable_Name: "H",
char_width: 8,
},
{
type: "static_text",
item_id: "sta5",
name: "Comments:",
},
{
type: "edit_text",
item_id: "Text5",
variable_Name: "COMMENTS",
width: 214,
height: 26,
char_width: 35,
},
{
type: "static_text",
item_id: "sta6",
name: "Invoice Amount:",
},
{
type: "edit_text",
item_id: "Text6",
variable_Name: "AMOUNT",
char_width: 8,
},
]
},
{
type: "ok_cancel",
width: 64,
height: 23,
},
]
},
]
}
};
JSADMDlg1.POSUB = "";
JSADMDlg1.PHASE = "";
JSADMDlg1.CC = "";
JSADMDlg1.H = "";
JSADMDlg1.COMMENTS = "";
JSADMDlg1.AMOUNT = "";
if("ok" == JSADMDlg1.DoDialog())
{
console.println("Text1:" + JSADMDlg1.POSUB);
console.println("Text2:" + JSADMDlg1.PHASE);
console.println("Text3:" + JSADMDlg1.CC);
console.println("Text4:" + JSADMDlg1.H);
console.println("Text5:" + JSADMDlg1.COMMENTS);
console.println("Text6:" + JSADMDlg1.AMOUNT);
}
Thanks in advance for the help!
Brian
So, for example, in this line:
console.println("Text1:" + JSADMDlg1.POSUB);
"JSADMDlg1.POSUB" is the value entered into the dialog.
it should be changed to something like:
this.getField("Text1").value = JSADMDlg1.POSUB;
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script