Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

JavaScript Warning text

Explorer ,
Aug 19, 2022 Aug 19, 2022

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?

TOPICS
How to , JavaScript , PDF forms
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Aug 19, 2022 Aug 19, 2022
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2022 Aug 19, 2022
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 19, 2022 Aug 19, 2022

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2022 Aug 19, 2022

Did you read the last post in that link ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2022 Aug 20, 2022
LATEST

You can't define a trusted function at document level.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 19, 2022 Aug 19, 2022

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

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