Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
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

So again my questions: Do you get any errors on the JavaScript console? What do you see in the "CC:" field in the email that arrives at the "To:" address?

Avatar

Level 2

Karl,

When I check the Script I get no errors.

I had sent a screen shot but.. apparently didn’t come through, I see nothing in the CC field or a CC field when I receive the filled out form.

Will upload a snap shot of what I see

Dean R

Avatar

Level 2

Karl,

This is all I see what a Form comes in.

Snap shot Form.PNG

Avatar

Level 3

This looks like this document is part of a "distribute form" workflow. This means that you are very likely not even running the script that is associated with the button. BTW: You should see some output on the JavaScript console. There are a few "console.println()" commands in my code to print the field information retrieved from the form. If you don't see that, the script is not running, and therefore you are not getting any of the behavior programmed in it.

Are you using the "distribute form" function in Acrobat? If so, have you tried to just load the original form, without having Acrobat modify it?

Avatar

Level 2

Karl,

I am not seeing anything run when submit button is clicked.

I am distributing the form and then opening the PDF in Adobe Acrobat Reader, filling it out and submitting.

Just tried to open original undistributed form, filling it out and submitting but saw nothing run and didn’t receive a returned form?

Is there a way to send you a copy of the form for review?

Dean R

Avatar

Level 3

I tried to send you a direct message with my email address, but the forum software is not cooperating right now. When you click on my name in blue just above this comment, you can find a link to my web site, which has my email address in the lower right corner. I cannot promise that I will get to your document right away - my paying customers always come first.

Avatar

Level 2

Karl,

A copy has been sent for review.

Thank you,

Dean R

Avatar

Level 3

You are using an email submission button - which sounds like the right thing to do, but in this case that's wrong: The stock email submission button is a one-trick pony, and it does exactly what it's designed to do: It submits the form to the email address you used when you first set up the form. As you may have noticed, you cannot add a "click" handler to this button (and I assume that's the reason why you added the script as a mouse-up event handler), because it's already hard coded to do that one thing. You will need to add a normal "Button" and then add the script as a click handler.

Avatar

Level 2

Karl,

When I add a Button, drop the Script into the “Click” feature and try it I get a warning that I can’t save the field in form.

The Form is saved as a Dynamic XML and I never had this until I changed the Button?

Dean R

Avatar

Level 2

Karl,

When I add a Button, drop the Script into the “Click” feature and try it I get a warning that I can’t save the filled in form.

The Form is saved as a Dynamic XML and I never had this until I changed the Button?

Do you know the cause of this?

Dean R

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.

Avatar

Level 2

Karl,

Thank you for the feedback on this.

Making these changes does run the script and open an email page to send to the correct address.

Once saved to Enable more tools is it required to Distribute the file again?

Seems like when I Distribute it reverts back and won’t open email page.

Dean R

Avatar

Level 2

Karl,

I have tried to apply this same Script to another form but it appears nothing happens when I select Submit.

I have changed to a standard Button, placed the script on the Click selection, save.

Open in Adobe and followed the Save to Enable more tools but when I select Submit I don’t get the email window or see any action.

I didn’t see where this Script was form specific. Is it?

Dean R

Avatar

Level 3

No need to distribute, just attach the reader-enabled file to an email or upload it to a web page. When you "Distribute", Acrobat will actually try to reader-enable the document as well.

The script is form specific, because it is trying to get information from certain fields. If these fields are not there, you will have to either adjust the script, or make it resistant against missing information. You can do that using a try/catch exception handler.

Avatar

Level 2

I am not familiar with "Try/Catch exception handler", how is it applied?

Using the same script after modifications to email address and making sure the ClientEmail field matches I am still not getting an email window to send as if the script is not running again?

Have opened and saved through Adobe Saved Enabled, is there something I am missing or another change that is required?

Note: I am not using the BennyEmail field but haven't changed the Script to remove it which is what I did on previous form.

Avatar

Level 3

Does this happen on both Acrobat and the free Reader? if it also happens in Acrobat, then open up the JavaScript console (Ctrl-J) and look for error messages. If it only happens in Reader, open up Reader's Preferences, go to the JavaScript category and enable  "Show console on errors and messages".

Exception handing in JavaScript is nothing specific to Acrobat, it's just standard JavaScript. Here is some information about how to do that: https://www.w3schools.com/js/js_errors.asp

Avatar

Level 2

I am using Adobe Acrobat XI Pro to read but see no option to check Java.

If I go to additional tools I have the option to purchase but nothing commonly available.

In LiveCycle I can check script syntax but get no highlighted lines or expressed errors.

Avatar

Level 3

In Acrobat XI Pro, you should be able to use Ctrl-J to see the JavaScript console.

Avatar

Level 2

Nothing happens when I use Ctrl-J.

If I select Tools from top menu I am taken to a page where I can purchase for 14.99 month.

Avatar

Level 2

I had to look into preferences and turn on Javascript  Debugger and now I get a pop up window when I select submit button.

Seem to be more with format of page then the submit button.

Below is what I see in the Debug page:

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:E1000-Costing-Subform[0]:E1000-BaseCost[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:ES1000-Costing-Subform[0]:ES1000-BaseCost[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:ES1500-Costing-Subform[0]:ES1500-BaseCost[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:ES1750-Costing-Subform[0]:ES1750-BaseCost[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:CT2000-Costing-Subform[0]:CT2000-BaseCost[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD600-Costing-Subform[0]:WD600-BasePricing[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD600-Costing-Subform[0]:WD600-PaintFinishAdder[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD600-Costing-Subform[0]:WD600-PowderFinishAdder[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD800-Costing-Subform[0]:WD800-BaseCost[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD800-Costing-Subform[0]:WD800-PaintFinishAdder[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD800-Costing-Subform[0]:WD800-PowderFinishAdder[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD1000-Costing-Subform[0]:WD1000-BaseCost[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD1000-Costing-Subform[0]:WD1000-PaintFinishAdder[0]:validate

ReferenceError: invalid assignment left-hand side

3:XFA:form1[0]:Page2-CostingSheet[0]:WD1000-Costing-Subform[0]:WD1000-PowderFinishAdder[0]:validate

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

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

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

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

Avatar

Level 3

This sounds like you are running the free Reader, and not Adobe Acrobat Pro. When you go to the "Help" menu and look at the "About" option, what does it say?