Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Email Submit button to one external address

Avatar

Level 2

When I add an email Submit Button it only comes to me as the creator of the form.

I would like it to go to another external Sales email address only.

I have looked on line and have found some other scripts but they don't do exactly what I am looking for.

Script I have used goes to an external but also to me along with providing additional inputs.

I have tried to remove the additional inputs but then the script doesn't work.

Help on this issue would be appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Sorry for the delay, but participating here in the forums comes after family, work, eating and sleeping, so sometimes it takes a bit longer until I can reply

I assume this is happening in the free Reader. The reason for this is that even though recent versions of the free Reader can fill and save AcroForms (the type of form you create in Adobe Acrobat), XFA forms (the ones created in LiveCycle Designer) are not supported by this "free" feature. You will have to reader-enable your form in Adobe Acrobat. In Acrobat DC for example, you would select File>Save As Other>Reader Extended PDF>Enable More Tools. Once you've done that, you should be able to fill and save in both Acrobat and the free Reader.

View solution in original post

50 Replies

Avatar

Level 3

Again, what you describe sounds like you are running this in Reader and not in Acrobat. Most of these error messages are about a validation event. I would recommend that you post a different question about these errors, they don't seem to have anything to do with your original email submission problem. This way, you may get some new eyes on your problem.

Avatar

Level 3

Is this before or after you try to submit via email?

Avatar

Level 2

This is what I see after pushing the Submit button several time.

TypeError: xfa.resolveNode("ClientEmail") is null

7:XFA:form1[0]:Data[0]:Button1[0]:click

TypeError: xfa.resolveNode("ClientEmail") is null

7:XFA:form1[0]:Data[0]:Button1[0]:click

TypeError: xfa.resolveNode("ClientEmail") is null

7:XFA:form1[0]:Data[0]:Button1[0]:click

This is what the Script looks like (email name changed):

// 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  = "sales123@123.com";

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

var cCCAddr = xfa.resolveNode("ClientEmail").rawValue;

  1. console.println("Client: " + cCCAddr);

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

var cBenAddr = xfa.resolveNode("BennyEmail").rawValue;

  1. console.println("Benny: " + cBenAddr);

if(cBenAddr != "")

    cCCAddr += ";" + cBenAddr;

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

var pn = xfa.resolveNode("polisnummer").rawValue;

var cSubLine = "Form X-1 returned from client " + pn;

var cBody = "Thank you for submitting your form.\nSave the mail attachment for your own records";

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

  1. event.target.mailDoc({

      bUI: false,

      cTo: cToAddr,

      cCc: cCCAddr,

      cSubject: cSubLine,

      cMsg: cBody,

  });

Avatar

Level 3

This again is a problem that has nothing to do with the original question.

I wish I could spend more time on your problem, but I am in the midst of

racing agains a deadline. Your chances of getting somebody else to chime in

are much higher if you post a new question.

Avatar

Level 2

I believe the error in regards to the email is the only issue at hand but I do appreciate your time & help.

You have been very helpful

TypeError: xfa.resolveNode("ClientEmail") is null

7:XFA:form1[0]:Page1[0]:Data[0]:Button1[0]:click

Dan R

Avatar

Level 3

This error message indicates that the script has a problem getting the value of the field ClientEmail - this is not related to your overall email issue you had when you started this question.

Avatar

Level 3

Dean,

As I mentioned before, the error message points to the resolveNode() call returning null because it cannot find the field name you've specified. In XFA forms, it's important that you know where your fields are, relative to where you want to use them.

I would suggest that you let Designer figure out how it can "get to" the field in question. You can do this by using the following approach.

The line that is not working is as follows:

var cCCAddr = xfa.resolveNode("ClientEmail").rawValue;

Remove the "xfa.resolveNode("...") from the code and then place your cursor right before the ".rawValue;". Now hold down the Ctrl key and click on the "ClientEmail" field in the design view. Based on the form you're provided, Designer will change this line to

var cCCAddr = WindowInformation.ClientEmail.rawValue;

Do this will all the field references that are causing you problems. There are different ways you can get a reference to a field in an XFA form - xfa.resolveNode is one way, but for simple names, you can just use the field name (unless it contains special characters, or starts with a digit) - and this is what Designer does in this case.

Avatar

Level 2

Karl,

Thank you for that response.

I was able to work through each line and finally make it function correctly.

Dean R