Hello , I was hoping someone could help me finish this code. Ive managed to piece this together from existing dynamic stamps and some API Javascript guide, but I have hit a dead end. Most everything is working but some final tweaks are needed.
1st the popup list result. I need the result from the popup list to be placed in a text field. Right now it reports the result in a java popup window, I tried to remove it but it seems to break the code.
2nd i would like to make the result returned from the radio buttons to be Yes and No instead of True False
Here is the code so far.
var dialog = {
exhibitValue: "",
caseValue: "",
// This dialog box is called when the dialog box is created
initialize: function(dialog) {
this.loadDefaults(dialog);
},
// This dialog box is called when the OK button is clicked.
commit:function (dialog) { // called when OK pressed
var results = dialog.store();
this.Date = results["txt1"];
this.exhibitValue = results["txt2"];
this.datebilled = results["txt4"];
this.Outsourced = results["txt5"];
var elements = dialog.store()["subl"];
for(var i in elements) {
if ( elements[i] > 0 ) {
app.alert("You chose \"" + i
+ "\", which has a value of " + elements[i] );
}
}
},
loadDefaults: function (dialog) {
dialog.load({
subl:
{
"Acrobat Professional": +1,
"Acrobat Standard": -2,
"Adobe Reader": -3
}
})
},
description:
{
name: "VVVVVVVVVVVVVVVVVVV", // Dialog box title
elements: // Child element array
[
{
type: "view",
align_children: "align_left",
elements: // Child element array
[
{
name: "TEST: ",
type: "static_text",
font: "ariel"
},
{
item_id: "subl",
type: "popup",
width: 140,
},
{
name: "Date: ",
type: "static_text",
},
{
item_id: "txt1",
type: "edit_text",
multiline: true,
width: 168,
height: 20
},
{
name: "Outsourced: ",
type: "static_text",
},
{
type: "radio",
item_id: "txt5",
name: "No",
group_id: "g1",
width: 30,
height: 25
},
{
type: "radio",
item_id: "txt5",
name: "Yes",
group_id: "g1",
width: 30,
height: 25
},
{
name: "GL Code: ",
type: "static_text",
},
{
item_id: "txt2",
type: "edit_text",
multiline: true,
width: 168,
height: 20
},
{
name: "Date invoiced on: ",
type: "static_text",
},
{
item_id: "txt4",
type: "edit_text",
multiline: true,
width: 168,
height: 20
},
{
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel"
},
]
},
]
}
};
if(event.source.forReal && (event.source.stampName == "#caseandnumfill"))
{
if ("ok" == app.execDialog(dialog))
{
var cMsg = dialog.Date;
event.value = "Case:\n" + cMsg;
event.source.source.info.exhibit = cMsg;
cMsg = "GL Code:\n" + dialog.exhibitValue;
this.getField("ExhibitNumFieldF").value = cMsg;
cMsg = "Bill Date:\n" + dialog.datebilled;
this.getField("datebilled").value = cMsg;
cMsg = "Outsourced:\n" + dialog.Outsourced;
this.getField("Outsourced").value = cMsg;
cMsg = "subl:\n" + dialog.subl;
this.getField("subl").value = cMsg;
}
}
I have managed to break the dropdown result java popup but it would be nice to clean up that part of the code. I still cant get the result to go to the text field. It returns "undefined" result in text box.