Hello all,
I have exactly the same problem as this member, here's his post: http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=22488
Here is the post in it's entirety:
I have the following short script to create a custom dialog box.
var oDlg =
{
shRate:0,
initialize: function(dialog)
{
console.println("In init: this.shRate = "+this.shRate);
dialog.load({"shRateField":this.shRate});
},
commit: function(dialog)
{
var data = dialog.store();
var testString = data["shRateField"];
console.println("In commit: testString is: "+testString);
this.shRate = parseFloat(testString);
console.println("In commit: this.shRate is: "+this.shRate);
var subtotal = getField("SubtotalField").value;
var shAmount = subtotal*((parseFloat(this.shRate))/100);
console.println("Shipping & Handling Rate is: "+this.shRate+" Shipping & Handling Amount is: "+shAmount);
},
description:
{
name: "Shipping & Handling Calculation Dialog",
elements:
[
{
type:"view",
elements:
[
{
name:"Enter Shipping & Handling Rate(%):",
type:"static_text",
},
{
item_id:"shRateField",
type:"edit_text",
char_width:10
},
{
type:"ok_cancel",
},
]
}
]
}
};
//Dialog Activation
app.execDialog(oDlg);
I get the following result on the console:
In init: this.shRate = 0
In commit: testString is: undefined
In commit: this.shRate is: NaN
Shipping & Handling Rate is: NaN Shipping & Handling Amount is: NaN
When I open the dialog box I type a value of 10 in the textfield name "shRateField".Can someone help me understand why when I hit "OK" I'm getting "undefined" as the value in this field? I'm running a trial version of Adobe Acrobat Pro 9.
Many thanks,
VG
The member then says he got it to work but doesn't state how. Has anyone ran into this problem before? How did you fix it?
http://www.windjack.com/products/acrodialogs.php
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