Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    error in JavaScript on Adobe Acrobat form: emailing

    I've not done anything with JavaScript before, so I'm not sure what syntax error I'm committing.

    I have a form made in Acrobat 9 for the Mac, and on it there is a "submit via email" button. I want the resulting email, which will contain the filled out Acrobat form as an attachment, to use field from the form to populate the subject line and the CC address field. I've bodgered together some code from this Acrobat user's post, but in trying to customize it, my script has fallen apart.

    I think it should be a simple fix, but since I'm so new, I can't see it.

    My script so far is:

    Code:
    // 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 = "fogharty@xxx.xxx";
    
    // First, get the client CC e-mail address
    var cCCAddr = this.getField("Teacheremail").value;
    
    
    // Set the subject and body text for the e-mail message
    var cSubLine = "this.getField("CourseNumber").value; 
    + "corrections form submitted by " +
    + this.getField("TeacherName").value;
    var cBody = "\n Thank you for submitting your form.\n" +
                   "Save the mail attachment for your own records";
    
    // Send the form data as an PDF attachment on an e-mail
    this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr, 
      cSubject: cSubLine, cMsg: cBody});
    So I would like the subject line to read (CourseNumber) corrections form submitted by (TeacherName)

    Acrobat tells me I have a "SyntaxError: missing ; before statement
    11: at line 12"

    but no matter how I tweak it, I keep getting that message. I put the semi-colon in, I take the semi-colon out, I put the semi-colon back in and shake it all about.... nothing.

    Any help someone could give me will be greatly appreciated, thanks

    Oh, and would there be a way to have the sent pdf form have it's name from a couple of fields as well? So that the attached file will be called "(CourseNumber).pdf"?
    Last edited by fogharty; 07-07-2011 at 10:31 PM. Reason: additional info

  • #2
    Regular Coder
    Join Date
    Jun 2011
    Location
    Swindon, England
    Posts
    124
    Thanks
    3
    Thanked 9 Times in 9 Posts
    Not sure exactly as Im not at my pc so can't see properly or fiddle but...

    Code:
    var cSubLine = "this.getField("CourseNumber").value;
    The ; at the end of this line should not be there.

    Hope it helps (if only a bit)

  • #3
    Regular Coder
    Join Date
    Jun 2011
    Location
    Swindon, England
    Posts
    124
    Thanks
    3
    Thanked 9 Times in 9 Posts
    You also have a repeated + symbol where the line breaks here:

    Code:
    + "corrections form submitted by " +
    + this.getField("TeacherName").value;
    Again hope it helps if only a little.

  • #4
    Regular Coder
    Join Date
    Jun 2011
    Location
    Swindon, England
    Posts
    124
    Thanks
    3
    Thanked 9 Times in 9 Posts
    And an unexpected " (the first in this chunk of code before this.getField):

    Code:
    var cSubLine = "this.getField("CourseNumber").
    Sorry for the bomb of posts. I think I'm done! =)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •