9 Replies Latest reply on Jun 17, 2013 12:08 AM by try67

    How can I have text from multiple fields on one layer, copy to one field on another layer?

    Teza74

      A little help please as it's been years since I've done any coding of any sort.

       

      So I have a 4 page document with various field types.  I have a document script that gets "TodaysDate" that works perfectly and a few other scripts as well.

       

      So what I'm trying to do is find a work around for the following:

       

       

      I have 3 fields - SURNAME, FIRSTNAME & dob.

      Info.jpg

      And I want what is typed into these fields to populate into 1 field.  And according to this tutorial (http://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript) it's not exactly possible.  At least I think that's what it says.

      However I'm hoping that maybe I could have a Submit button at the end of that document that when clicked would copy the text from those 3 fields (that I would have on 1 layer) into 1 field on a 2nd layer.  Is that even possible??

      I'd also like to have the document Print, Save (using the text in the field on the 2nd layer as the file name), Email (using the text in the field on the 2nd layer as the subject line) and Export to a specific Excel spreadsheet. 

       

       

      I don't want much do I?

       

      I'm using Acrobat 9 Pro on a Windows PC but also have access to Acrobat 8 Professional.  And I'm going to want the form to run in Acrobat Reader X.

       

      So far I have for the 3 fields into 1 on another layer:

       

      function buttonClick(){

      if(buttonClick==false)

      {

      event.value=this.getField("SURNAME"+"-"+"FIRSTNAME"+"-"+"dob").valueAsString;

      }

      }

       

      But I have no idea how to call the event.value from 1 layer to another or if any of that code above would even work at all.

       

      I have a script that I believe will work perfectly for the Save and Email function:

       

      Using the “doc.submitForm()” function

      // This is the form return e-mail. Its hardcoded

      // so that the form is always returned to the same address

      // Change address on your form

      var cToAddr = "formsAdmin@BigCorp.com";

      // First, get the client CC e-mail address

      var cCCAddr = this.getField("ClientEmail").value;

      // Now get the beneficiary e-mail only if it is filled out

      var cBenAddr = this.getField("BennyEmail").value;

      if(cBenAddr != "") cCCAddr += ";" + cBenAddr;

      // Set the subject and body text for the e-mail message

      var cSubLine = "Form X-1 returned from client"; var cBody = "Thank you for submitting your form.\n" + "Save the mail attachment for your own records";

      //** Send the form data as an XML attachment on an e-mail

      // Build the e-mail URL

      var cEmailURL = "mailto:formsAdmin@BigCorp.com?cc=" + cCCAddr + "&subject=" + cSubLine + "&body=" + cBody;

      1. this.submitForm({

                  cURL: cEmailURL,

                  cSubmitAs:"XML",

                  cCharSet:"utf-8"

      });

       

      I'll work out the Export to Excel thing later as I've seen many tutorials on that.  But can I do the 3 fields to 1 thing at all?

       

      Please Help!!!