2 Replies Latest reply on Apr 25, 2017 12:58 PM by George_Johnson

    General Error When Using execDialog

    sdbrigma Level 1

      I'm trying to create a dialog box form a mouse up action in a form, but the text that's entered in the box never appears in the assigned field.

       

      Here is the code that I have in a separate file within C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts

      function trustedDialog(data){
        console.println("trustedDialog function");
        app.beginPriv();
        try {app.execDialog(data);}
        catch (e) {console.println("Trusted Dialog box exception is: " + e);}
        app.endPriv();
        return;
        };
        app.trustedFunction(trustedDialog);
      

      Here is the code that I have for the mouse up event.

       

      var oDlg = {
        strName: "", initialize: function(dialog) { 
           dialog.load({"usnm":this.strName}); },
              commit: function(dialog) { 
                    var data = dialog.store();
                    this.strName = data[ "usnm"];},
              description: { name: "KSA Input Box", elements: [
              { type: "view", elements: [
              { name: "Enter your text here:", type: "static_text", },
        { item_id: "usnm", type: "edit_text", char_width: 15, multiline: 1, height: 500, width: 500},
        { type: "ok_cancel", },
        ] },
        ] }
      };
      
      
      var f = this.getField("TextBody");
      
      
      if( "ok" == trustedDialog(oDlg)) { 
          f.value = oDlg.strName; 
      }
      

       

      Whenever I run my code I'm getting this error in the console, and I haven't been able to figure out why.

      Exception in line 35 of function trustedDialog, script Folder-Level:App:priveleges.js

      Trusted Dialog box exception is: GeneralError: Operation failed.