Inspiring
March 3, 2023
Answered
Checkboxes Not showing checked or unchecked in Dynamic Stamp
- March 3, 2023
- 2 replies
- 4727 views
Hello Members,
I have created a PDF DYNAMIC STAMP, consisting of 4 text fields and 4 checkboxes. Everything is working fine except for the checkboxes.
When I put data in the dialog box including the checkbox, The results of checkboxes (Checked/Unchecked) not showing up in Stamp.
//Checkbox Fields Name:
Check Box1
Check Box2
Check Box3
Check Box4
I have attached a ScreenShot of the stamp and JAVASCRIPT that I'm using now;
Thanks.
Software: Adobe Acrobat Pro DC.
var FormRouting = {
return: 'cancel',
DoDialog: function () {
return app.execDialog(this);
},
bChk1: false,
bChk2: false,
bChk3: false,
bChk4: false,
str1: '',
str2: '',
str3: '',
str4: '',
initialize: function (dialog) {
var dlgInit = {
Chk1: this.bChk1,
Chk2: this.bChk2,
Chk3: this.bChk3,
Chk4: this.bChk4,
Str1: this.str1,
Str2: this.str2,
Str3: this.str3,
Str4: this.str4,
};
dialog.load(dlgInit);
},
commit: function(dialog) {
var oRslt = dialog.store();
this.bChk1 = oRslt['chk1'];
this.bChk2 = oRslt['chk2'];
this.bChk3 = oRslt['chk3'];
this.bChk4 = oRslt['chk4'];
this.str1 = oRslt['str1'];
this.str2 = oRslt['str2'];
this.str3 = oRslt['str3'];
this.str4 = oRslt['str4'];
},
description: {
titlename: "Personal Data",align_children: "align_left", width: 500, height: 400, elements:
[
{
type: "cluster", name: "Data Entry", align_children: "align_left", elements:
[
// Text Field Code Below
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Field 1:"
},
{
item_id: "str1", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Field 2:"
},
{
item_id: "str2", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "Field 3:"
},
{
item_id: "str3", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
// Check Box Field Code below
{
type: "view", align_children: "align_row", elements:
[
{
item_id: "Chk1", type: "check_box", alignment: "align_fill", width: 5, height: 20
},
{
type: "static_text", name: "CheckBox 1"
}
]
},
{
type: "view", align_children: "align_row", elements:
[
{
item_id: "Chk2", type: "check_box", alignment: "align_fill", width: 5, height: 20
},
{
type: "static_text", name: "CheckBox 2"
},
]
},
{
type: "view", align_children: "align_row", elements:
[
{
item_id: "Chk3", type: "check_box", alignment: "align_fill", width: 5, height: 20
},
{
type: "static_text", name: "CheckBox 3"
},
]
},
{
type: "view", align_children: "align_row", elements:
[
{
item_id: "Chk4", type: "check_box", alignment: "align_fill", width: 5, height: 20
},
{
type: "static_text", name: "CheckBox 4"
},
]
},
// By Field
{
type: "view", align_children: "align_row", elements:
[
{
type: "static_text", name: "By: "
},
{
item_id: "str4", type: "edit_text", alignment: "align_fill", width: 400, height: 20
}
]
},
]
},
{
alignment: "align_right",
type: "ok_cancel",
ok_name: "ok",
cancel_name: "Cancel"
}
],
},
};
if (event.source.forReal && event.source.stampName == "Sohail") {
if ('ok' == FormRouting.DoDialog()) {
// Checkboxes Fields
if (FormRouting.bChk1) {
this.getField('Check Box1').checkThisBox(0, true);
}
if (FormRouting.bChk2) {
this.getField('Check Box2').checkThisBox(0, true);
}
if (FormRouting.bChk3) {
this.getField('Check Box3').checkThisBox(0, true);
}
if (FormRouting.bChk4) {
this.getField('Check Box4').checkThisBox(0, true);
}
// string fields
this.getField('Field 1').value = FormRouting.str1;
this.getField('Field 2').value = FormRouting.str2;
this.getField('Field 3').value = FormRouting.str3;
this.getField('By').value = FormRouting.str4;
}
}
