6 Replies Latest reply on Nov 15, 2013 7:47 AM by MadMich

    Trusted function help

    MadMich Level 1

      Hi all,

       

      I need to clarify if i am looking in the right place!

       

      I have a form with templates, when the first page is signed there is a button to create a second page from a template (with a new signature).

      I get this error:

      NotAllowedError: Security settings prevent access to this property or method.

      Template.spawn:17:AcroForm:P0.Background.Tab:Annot1:MouseUp:Action1

       

      I believe this is a trusted function issue, so I tried to write the following to accomodate in my code:

       

       

      –––––––––––––––––––––––––––––––

      function test()

       

          {

       

              var t = this.templates;

      var j = this.pageNum;

       

          var T = t[0];

          var S = t[1];

          var R = t[3];

          var Q = t[2];

       

      // Checks other field value before selecting correct template

      if (this.getField("P"+j+".Background.Dropdown4").value == "Other"){

       

      T.spawn({nPage: numPages, bRename: true, bOverlay: false});

      Q.spawn({nPage: numPages - 1, bRename: true, bOverlay: true});

      app.alert("A new page has been added")

       

      }else if (this.getField("P"+j+".Background.Dropdown4").value == "option 1"){

       

      T.spawn({nPage: numPages, bRename: true, bOverlay: false});

      S.spawn({nPage: numPages - 1, bRename: true, bOverlay: true});

      app.alert("A new page has been added")

       

      }else if (this.getField("P"+j+".Background.Dropdown4").value == "option 2"){

       

      T.spawn({nPage: numPages, bRename: true, bOverlay: false});

      R.spawn({nPage: numPages - 1, bRename: true, bOverlay: true});

      app.alert("A new page has been added")

       

      }else if (this.getField("P"+j+".Background.Dropdown4").value == "Select..."){

      app.alert("Please make selection, from Category");

       

      }};

       

          app.trustedFunction(test);

      –––––––––––––––––––––––––––––––––

       

      I have this as a document level javascript but im not usre if this is correct, i want to avoid creating a js folder to hold the script as i have many users.

      Because Acrobat X now uses this trusted function i need to update quite a few forms, so your help would be much appreciated.

        • 1. Re: Trusted function help
          try67 MVP & Adobe Community Professional

          The spawn method does not require a trusted context. It probably has to do with the fact that you're trying to edit a signed document, though...

          • 2. Re: Trusted function help
            MadMich Level 1

            Thanks for the info.

             

            So how do i create a form in X that goes to different departments for sign off like so:

             

            Page 1: if approved signed and no second page created. If rejected signed and a second page created for re approval process?

             

            ...and so on.

            • 3. Re: Trusted function help
              try67 MVP & Adobe Community Professional

              Signing is the last step of the review process. After a file is digitally signed it should not be edited in any way, or the digital signature will be invalidated. That's the entire point of such a signature...

              • 4. Re: Trusted function help
                MadMich Level 1

                Thanks again for the input but I'm confused, by your comments?

                You can have as many signatures on one page as you like? Each performing a different validation task.

                 

                If one person adds values to fields and then signs a signature a second person can then approve these values in and adjacent field on the same page and then sign those off! Why would that be wrong?

                • 5. Re: Trusted function help
                  try67 MVP & Adobe Community Professional

                  Signing a signature field does not consitute editing the file.

                  Adding new pages to a file does.

                   

                  Think about a real-life situation: You sign a 20-page contract.

                  Then someone adds their signature next to yours. That's not a problem because it doesn't affect what you signed, just says that another person is a part of the contract.

                  However, imagine that after you've signed the contract someone adds a 5-page appendix to it and pretends you signed that as well... You wouldn't be too happy about it, right? That appendix should not be added unless you sign it as well.

                  Well, digital signatures have that function built-in into them. You can't edit the file without invalidating the signature(s) in it.

                  • 6. Re: Trusted function help
                    MadMich Level 1

                    Thanks for the feedback, i get it now as i basically want to add new pages.

                    I didn't realise that adding new pages to a signed document was forbidden.

                    I will work out another solution. Cheers as ever for you help.

                    1 person found this helpful