Copy link to clipboard
Copied
Is it possible to remove the "JavaScript Warning text/titles on my dialog and alert boxes? This would awesome if it is and how do I do it?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
So here's the code I currently have. I'm sure I'm doing something wrong.
var dialogTrust = app.trustedFunction(function()
{
app.beginPriv();
var dialog1 = {
initialize: function (dialog) {
// Create a static text containing the current date.
var todayDate = dialog.store()["date"];
todayDate = "Date: " + util.printd("mmmm dd, yyyy", new Date());
dialog.load({ "date": todayDate });
},
commit:function (dialog) { // called when OK pressed
var results = dialog.store();
// Now do something with the data collected, for example,
getField("Name").value = results["fnam"] + " " + results["lnam"];
},
description:
{
name: "Name Information", // Dialog box title
align_children: "align_left",
width: 350,
height: 200,
elements:
[
{
type: "cluster",
name: "Your Name",
align_children: "align_left",
elements:
[
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "First Name: "
},
{
item_id: "fnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "Last Name: "
},
{
item_id: "lnam",
type: "edit_text",
alignment: "align_fill",
width: 300,
height: 20
}
]
},
{
type: "static_text",
name: "Date: ",
char_width: 25,
item_id: "date"
},
]
},
{
alignment: "align_right",
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel"
}
]
}
};
app.endPriv();
});
Error I receive when trying to add the priveleged stuff:
NotAllowedError: Security settings prevent access to this property or method.
App.trustedFunction:1:Document-Level:Name
Copy link to clipboard
Copied
Did you read the last post in that link ?
Copy link to clipboard
Copied
You can't define a trusted function at document level.
Copy link to clipboard
Copied
The warning message isn't displayed if the dialog is executed in a privileged context. This is basically a function you create in a folder level script with the app.trustedFunction() method. Each of your users would have the script on thier system. Depending on your requirement you could put all of the functionality you were going to have in the document into a toolbar button that is on every one's system or just create trusted functions that display the dialogs and return the results to a document script.
Unfortunately creating a trusted dialog is not as simple as creating a trusted function. You also need to use the trused propagator function. Fortunately there is a nice example of doing this in the Acrobat JavaScript Ref in the notes for app.trustPropagatorFunction().
This may help you,
Rachel Gomez

