2 Replies Latest reply on Aug 24, 2012 2:49 AM by SBidd

    Call a Field in a Javascript

    SBidd

      I am trying to call a form field in a javascript that sends an email of the form.

       

      I would also like to final email to be a standard PDF not a form. Is this possible and if so what is the script.

       

      I currently have the following:

      var cToAddr = "sbiddlecombe@xxxxx.co.uk";

      var cCCAddr = "sbiddlecombe@xxxxx.co.uk";

      var cBody = "Thank you for submitting your form.\n" + "Please retain this mail attachment for your own records";

      var cSubLine = "Production Instructions ";

      this.mailDoc({   

      bUI: true,   

      cTo: cToAddr,   

      cCc: cCCAddr,   

      cSubject: cSubLine,   

      cMsg: cBody

      });

       

      This works great but now I would like to improve it further?

       

      Thanks

       

      Simon

        • 1. Re: Call a Field in a Javascript
          George_Johnson MVP & Adobe Community Professional

          Do you want to get the value of a form field and use it in a parameter of the mailDoc method? If so, you could do something like:

           

          var sText = getField("text1").valueAsString;

          var cBody = sText + " other test goes here.";

           

          You can't flatten a form - which converts the field appearances to regular page contents - with Reader, but you can set the fields to read-only:

           

          getField("text1").readonly = true;

          • 2. Re: Call a Field in a Javascript
            SBidd Level 1

            Thanks George This works perfectly.

             

            I have now added a print and send button to my form that Prints to the default printer, makes all fields read only and then sends the mail.

             

            My final question is can I set a close without saving option to this as I want the form to be used over and over again?

             

            If I just close the document when I open it again all fields are read only (as expected)

             

            Thanks Again

             

            Simon