Just trying to figure out how to create a Dynamic Stamp with the ability to select Checkboxes on the Stamp popup Dialog box. Im not very sure on what is going wrong at this point.

New Here ,
Mar 21, 2018

Copy link to clipboard

Copied

///Document level Script

if (event.source.forReal)

{

var stampDialog = CreateDialog(builder);

app.execDialog(stampDialog);

}

function CreateDialog(dialogBuilder)

{

var sd = new Object();

sd.builder = dialogBuilder;

bChk1:false;

bChk2:false;

bChk3:false;

bChk4:false;

stredt1:"";

sd.initialize = function(dialog)

{

var init =

{

"Chk1": this.bChk1,

"Chk2": this.bChk2,

"Chk3": this.bChk3,

"Chk4": this.bChk4,

"Name": this.stredt1,

};

dialog.load(init);

};

sd.commit = function(dialog)

{

var res = dialog.store();

this.bChk1 = res["Chk1"];

this.bChk2 = res["Chk2"];

this.bChk3 = res["Chk3"];

this.bChk4 = res["Chk4"];

this.byName = res["Name"];

};

sd.validate = function(dialog)

{

var res = dialog.store();

return true;

};

sd.description =

{

name: "Stamp Dialog",

elements:

[

{

type: "view",

elements:

[

{

type: "view",

char_height: 10,

elements:

[

{ type: "static_text", item_id: "stat", name: "WSB Approval", char_width: 15, alignment: "align_fill", font: "dialog" },

{

type: "view",

char_width: 8,

char_height: 8,

align_children: "align_top",

elements:

[

{

type: "view",

char_width: 8,

char_height: 8,

elements:

[{ type: "check_box", item_id: "Chk2", name: "Reviewed" },{ type: "check_box", item_id: "Chk3", name: "Reviewed as Noted" },{ type: "check_box", item_id: "Chk4", name: "Revise and Re-Submit" }]

}

]

}

]

},

{

type: "ok_cancel",

}

]

}

]

};

return sd;

}

Separate Global Script:

var builder =

{

}

Not sure what to define within Builder.

THIS IS THE ERROR IM RECIEIVING

PS.... This may or may not be Acrobat....but a very close relative... Same API per their support team ..who no longer assists with JavaScript or gives any sort of training sessions on it.

Thank you for your help in advance.

TOPICS
Acrobat SDK and JavaScript

Views

125

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Just trying to figure out how to create a Dynamic Stamp with the ability to select Checkboxes on the Stamp popup Dialog box. Im not very sure on what is going wrong at this point.

New Here ,
Mar 21, 2018

Copy link to clipboard

Copied

///Document level Script

if (event.source.forReal)

{

var stampDialog = CreateDialog(builder);

app.execDialog(stampDialog);

}

function CreateDialog(dialogBuilder)

{

var sd = new Object();

sd.builder = dialogBuilder;

bChk1:false;

bChk2:false;

bChk3:false;

bChk4:false;

stredt1:"";

sd.initialize = function(dialog)

{

var init =

{

"Chk1": this.bChk1,

"Chk2": this.bChk2,

"Chk3": this.bChk3,

"Chk4": this.bChk4,

"Name": this.stredt1,

};

dialog.load(init);

};

sd.commit = function(dialog)

{

var res = dialog.store();

this.bChk1 = res["Chk1"];

this.bChk2 = res["Chk2"];

this.bChk3 = res["Chk3"];

this.bChk4 = res["Chk4"];

this.byName = res["Name"];

};

sd.validate = function(dialog)

{

var res = dialog.store();

return true;

};

sd.description =

{

name: "Stamp Dialog",

elements:

[

{

type: "view",

elements:

[

{

type: "view",

char_height: 10,

elements:

[

{ type: "static_text", item_id: "stat", name: "WSB Approval", char_width: 15, alignment: "align_fill", font: "dialog" },

{

type: "view",

char_width: 8,

char_height: 8,

align_children: "align_top",

elements:

[

{

type: "view",

char_width: 8,

char_height: 8,

elements:

[{ type: "check_box", item_id: "Chk2", name: "Reviewed" },{ type: "check_box", item_id: "Chk3", name: "Reviewed as Noted" },{ type: "check_box", item_id: "Chk4", name: "Revise and Re-Submit" }]

}

]

}

]

},

{

type: "ok_cancel",

}

]

}

]

};

return sd;

}

Separate Global Script:

var builder =

{

}

Not sure what to define within Builder.

THIS IS THE ERROR IM RECIEIVING

PS.... This may or may not be Acrobat....but a very close relative... Same API per their support team ..who no longer assists with JavaScript or gives any sort of training sessions on it.

Thank you for your help in advance.

TOPICS
Acrobat SDK and JavaScript

Views

126

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 21, 2018 0
Adobe Community Professional ,
Mar 21, 2018

Copy link to clipboard

Copied

You're kind of going the long way around with this code. Have you tried running it in Acrobat/Reader?  I tried it and the dialog displays, there are no errors reported. But there is a problem with the bChk# members, they are not properly defined. However, if this is being used on a 3rd party viewer the issue could be with an unsupported feature.  I've done a lot of work with 3rd party viewers and if you want some consulting on the issue you can contact me. Message me through this site.

I would suggest rewriting this code in a more sensible manner. And adding some formatting so it can be read.

The builder input is nothing, get rid of it. This looks like a segment of code from someone that was trying to create an object factory, but never completed it.

It you want to find out more about Acrobat dialogs, see this site, in even has a dialog designer tool, so you don't have to write this code by hand.

Alerts, Popups, and Other Devices for Interacting with the User

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 21, 2018 2