Skip to main content
Participant
August 23, 2016
Answered

Dynamic Stamp - One Value Undefined

  • August 23, 2016
  • 3 replies
  • 923 views

Hello.

I am new to javascript. I have VBA experience in the past.

I have the following code in my dynamic stamp. The problem is with this results of this line. It returns undefined.

this.getField("ShopN").value = DiaBox.ShopN;

Wanted to know if someone could spot my error or point me in the right direction.

var DiaBox =

{

result:"cancel",

DoDialog: function(){return app.execDialog(this);},

cbx1:false,

cbx2:false,

cbx3:false,

cbx4:false,

LText:"",

ShopN:"",

RText:"",

initialize: function(dialog)

{

var dlgInit =

{

"Opt1": this.cbx1,

"Opt2": this.cbx2,

"Opt3": this.cbx3,

"Opt4": this.cbx4,

"lNum": this.LText,

"sdNum": this.ShopN,

"lRvw": this.RText,

};

dialog.load(dlgInit);

},

commit: function(dialog)

{

var oRslt = dialog.store();

this.cbx1 = oRslt["Opt1"];

this.cbx2 = oRslt["Opt2"];

this.cbx3 = oRslt["Opt3"];

this.cbx4 = oRslt["Opt4"];

this.LText = oRslt["lNum"];

this.ShopN = oRslt["sdNum"];

this.RText = oRslt["lRvw"];

},

description:

{

name: "Submittal Stamp",

elements:

[

{

type: "view",

char_height: 10,

elements:

[

{

type: "static_text",

item_id: "stat",

name: "Please select the review category:",

//width: 152,

//height: 23,

//char_width: 15,

alignment: "align_fill",

//font: "dialog",

},

{

type: "radio",

item_id: "Opt1",

group_id: "rado",

name: "Approved-No Exceptions Taken",

},

{

type: "radio",

item_id: "Opt2",

group_id: "rado",

name: "Approved as commented - No Resubmission",

},

{

type: "radio",

item_id: "Opt3",

group_id: "rado",

name: "Approved as commented - Resubmit",

},

{

type: "radio",

item_id: "Opt4",

group_id: "rado",

name: "Rejected-Comply With Comments",

},

{

type: "static_text",

item_id: "statl",

name: "Job Number:",

//width: 25,

//height: 15,

//char_width: 15,

alignment: "align_left",

//font: "dialog",

},

{

type: "edit_text",

item_id: "lNum",

height: 20,

char_width: 10,

char_height: 10,

alignment: "align_left",

name: "Proj. Number",

},

{

type: "static_text",

item_id: "statsd",

name: "Shop Drawing Number:",

width: 25,

height: 15,

char_width: 15,

alignment: "align_left",

font: "dialog",

},

{

type: "edit_text",

item_id: "sdNum",

height: 20,

char_width: 10,

char_height: 10,

alignment: "align_left",

name: "Shop Dwg Number",

},

{

type: "static_text",

item_id: "statr",

name: "Reviewer:",

width: 50,

height: 15,

char_width: 15,

alignment: "align_left",

font: "dialog",

},

{

type: "edit_text",

item_id: "lRvw",

height: 20,

char_width: 10,

char_height: 10,

alignment: "align_left",

name: "Reviewer",

},

{

type: "ok_cancel",

},

]

},

]

},

};

if(event.source.forReal && (event.source.stampName == "#qeSrVnbmgzmy5-DHsVTkLD"))

{

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

{

this.getField("cbx1").checkThisBox(0, DiaBox.cbx1);

this.getField("cbx2").checkThisBox(0, DiaBox.cbx2);

this.getField("cbx3").checkThisBox(0, DiaBox.cbx3);

this.getField("cbx4").checkThisBox(0, DiaBox.cbx4);

this.getField("LText").value = DiaBox.LText;

this.getField("ShopN").value = DiaBox.ShopN;

this.getField("RText").value = DiaBox.RText

this.getField("Date").value = util.printd("mm/dd/yyyy", new Date ());

}

}

This topic has been closed for replies.
Correct answer Karl Heinz Kremer

Item Ids can only have four letters, the corresponding ID for this field is "sdNum" - and therefore five characters long.

3 replies

try67
Community Expert
Community Expert
August 24, 2016

Also, there's no need to define an item_id property for static_text elements.

Inspiring
August 23, 2016

The "item_id" "sdNum" is too long. It can only be 4 characters in length.

Karl Heinz  Kremer
Community Expert
Karl Heinz KremerCommunity ExpertCorrect answer
Community Expert
August 23, 2016

Item Ids can only have four letters, the corresponding ID for this field is "sdNum" - and therefore five characters long.

Inspiring
February 15, 2017

Hi Karl,

I cannot stop myself saying a big thank you to you. You told such an important point none can think of it. Exactly four letters for item id, I read this and tried 3 letter that even did not work.

This should be well document and really a stupid one limitation for acro dialogs.

However thank you very much.

Arvind

try67
Community Expert
Community Expert
February 15, 2017

It is well-documented. Here's a quote from the JavaScript for Acrobat API Reference, app object, execDialog method:

Dialog box items are identified by an ItemID, which is a unique 4-character string. An ItemID is necessary

only if the element must be referred to elsewhere in the dialog box description (for example, to set or get a

value for the element, to add a handler for the element, or to set a tab order including the element).