Skip to main content
Participant
May 5, 2021
Answered

dynamic stamp - popup list - how to acquire list and text into stamp

  • May 5, 2021
  • 1 reply
  • 1049 views

Hi,

I am creating a dynamic stamp and I need help. The script is given below:

 

list_lis1 = {"Middle":-1,"Secondary":-1};
list_lis2 = {"AA-20":-1,"AA-21":-1;

var oJSDlg = {
strEdt1:null,
strEdt2:null,
strlis1:null,
strlis2:null,

GetListSel:function(oLst){for(var x in oLst){if(oLst[x]>0)return x;}return null;},

initialize:function(dialog){
var oInit = {
x001:this.strEdt1,
x002:this.strEdt2,
lis1:this.strlis1,
lis2:this.strlis2,

lis1:list_lis1,
lis2:list_lis2,
};
dialog.load(oInit);
},

validate:function(dialog){
var bRtn = true;
var oRslt = dialog.store();
return bRtn;
},

commit:function(dialog){
var oRslt = dialog.store();

this.strEdt1 = oRslt.x001;
this.strEdt2 = oRslt.x002;
this.strlis1 = this.GetListSel(oRslt.lis1);
this.strlis2 = this.GetListSel(oRslt.lis2);
},

description:{

name:"Default",
font:"default",
bold:true,
elements:[{type:"view",elements:[
{
type:"view",
item_id:"Vew1",
width:60,
alignment:"align_fill",
align_children:"align_row",
elements:[
{
type:"static_text",
item_id:"St01",
name:"Name",
width:115,
bold:true,
alignment:"align_left",
},
{
type:"static_text",
item_id:"St02",
name:"Amount",
width:90,
bold:true,
alignment:"align_left",
},
{
type:"static_text",
item_id:"St03",
name:"Class",
width:90,
bold:true,
alignment:"align_left",
},
{
type:"static_text",
item_id:"St04",
name:"List",
width:90,
bold:true,
alignment:"align_left",
},
],
},

{
type:"view",
item_id:"Vew2",
width:40,
align_children:"align_distribute",
elements:[
{
type:"edit_text",
item_id:"x001",
width:50,
},
{
type:"edit_text",
item_id:"x002",
width:50,
},
{
type:"popup",
item_id:"lis1",
width:50,
},
{
type:"popup",
item_id:"lis2",
width:50,
},
],
},
{
type:"ok_cancel",
},
]}]
}
}

if("ok"==app.execDialog(oJSDlg))

if (event.source.forReal && (event.source.stampName == "#classn"))

//////////////////////////// How to acquire data in list and text boxes? - please help!///////////////////////////////////

{
console.println("strEdt1 = "+oJSDlg.strEdt1);
console.println("strEdt2 = "+oJSDlg.strEdt2);
console.println("strPop1 = "+oJSDlg.strlis1);
console.println("strPop2 = "+oJSDlg.strlis2);
}

 

Please help me in acquiring data into stamp. 

This topic has been closed for replies.
Correct answer try67

Are the console.println commands at the end of your code outputting the correct values?

 

It's usually not recommended for end-users to share an email address here. If you want to share the file you can upload it to your original post, or share it via a file-sharing website (like Google Drive or Adobe Document Cloud), and then post the link to it here.

 

 

1 reply

try67
Community Expert
Community Expert
May 5, 2021

Add fields to the stamp and then use a command like this to apply the values to them:

this.getField("Text1").value = oJSDlg.strEdt1;

this.getField("Text2").value = oJSDlg.strEdt2;

etc.

verma76Author
Participant
May 5, 2021

Thank you for your response,  Try67.

I've already created the stamp, and I can apply the values to the text boxes. However, I am finding it difficult to acquire the list items into stamp. The dialog is working fine (created with AcroDiologs). I tried my best to understand JS with the help of "All About PDF Stamps" book written by Mr. Thomp, but failed. Please help me!

 

Can I share my email ID here?

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 5, 2021

Are the console.println commands at the end of your code outputting the correct values?

 

It's usually not recommended for end-users to share an email address here. If you want to share the file you can upload it to your original post, or share it via a file-sharing website (like Google Drive or Adobe Document Cloud), and then post the link to it here.