Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Another Email Submit Button Help Request

Avatar

Former Community Member

I have been reading the numerous email submit buttons and trying many suggestions posted, including excellent sample files showing several methods to accomplish, and have not had total success with any method quite yet, I'm sure due to my lack of knowledge in this area, not due to the good examples and instructions.  The sample I found here, http://forums.adobe.com/message/2522202#2522202, is the closest to what I'm needing with 2 exceptions.

1. Need form submitted as PDF, not XML. 

2. Need subject to include a company name field

Otherwise, it seems to do just what I need.  If I make a field required in the sample, it doesn't let me submit till I complete the required.  It holds the subject, email text, etc. when converted to adobe reader extended form, and if it can be modified to send as PDF and include form field company name in subject it would be so fantastic.

The JavaScript in the sample is below.  I would greatly appreciate any help in this last hurdle in my form, thank you.


form1.page1.emailButton::click - (JavaScript, client)

// First give a messageBox with instructions

xfa.host.messageBox("This will open your email client and prepare an email for you. "

+

"Please make sure you send the email to complete the process."

+

"\n\nIf you experience any difficulties or if you are using a "

+

"web based email client, then please save this form and "

+

"manually email it to someone@acompany.ie\n\nThank you!"

, "Email Instructions", 3, 0);

xfa.host.beep("3");

// then pass instructions through to email client

var

vEmail = "someone@acompany.ie";

var

vSubject = "A9100 - Example of Email Button Script"

var

vBody = "Hi\n\nPlease find attached the completed form in xml format.\n\nRegards,\n\nNiall"

event.target.submitForm({cURL

:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody,cSubmitAs:"XML",cCharset:"utf-8"});

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Just change the cSubmitAs parameter to PDF instead of XML

To get the company name into the subject you can do that when you set the variable. Assuming that the company name is in a field called companyName:

vSubject =

"A9100 - Example of Email Button Script and the company Name added: " + CompanyName.rawValue

The part in quotes will come out as you have typed them and the value of the field companyName will be appended to the end of the string.

Paul

View solution in original post

10 Replies

Avatar

Former Community Member

The only issue I see is that the 2nd last line has event.target..... at the end of it. That needs to be on a new line with the last line attached to it (it might be the editor in the forum that broke the line out). So it should look like this:

event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody,cSubmitAs:"XML",cCharset:"utf-8"});

Once I did that it worked fine for me in Acrobat. If you want to use Reader the form must be Reader Extended to allow for a local save. The Reader Extending can be achieved in Acrobat.

Paul


Avatar

Former Community Member

Thank you, yes, it may have been the way I pasted into editor, as the actual button is the way you mention.  How do I modify it so it will send as PDF instead of XML?  The button type is Regular in this sample, so the options to select PDF are not there, and it works perfectly for me otherwise so I'm hesitant to change the type.  The other part is I need to include the company name in subject.  Learning how to modify these 2 issues would be extremely helpful, as once this form is completed, there is a backlog of other Word or PDF forms needing converting to LiveCycle and the premise of the email submit button will be the same.  Thank you.

Avatar

Correct answer by
Former Community Member

Just change the cSubmitAs parameter to PDF instead of XML

To get the company name into the subject you can do that when you set the variable. Assuming that the company name is in a field called companyName:

vSubject =

"A9100 - Example of Email Button Script and the company Name added: " + CompanyName.rawValue

The part in quotes will come out as you have typed them and the value of the field companyName will be appended to the end of the string.

Paul

Avatar

Former Community Member

Perfect, thank you.  Works great from the button, but not from the standard 'submit form' in purple, and that is ok, but is there a way to disable the purple one?  If not, will just go with it as is.  Thank you again.

3-18-2010 10-16-20 AM.jpg

Avatar

Former Community Member

No ...the purple one is put there by Acrobat and I do not believe you can hide it.

Paul

Avatar

Former Community Member

Thanks, that's what it was looking like, but at least there is control over the other email submit. Thanks so much for the help.

Avatar

Former Community Member

I bumped into a problem - this morning when I tested, all was well, and I still have the outgoing test emails in my mailbox to show I wasn't losing my mind, it really did work.  HOWEVER - I do not know what has happened, when I add the  + CompanyName.rawValue, the submit button no longer wroks.  If I remove the  + CompanyName.rawValue and just have the quoted text, all is well.  The odd part is this morning when I was adding it in, when I would enter the field name and press the period, the rawValue, among other options, showed up in a picklist, but now when I type the period, nothing happens.  I'm used to Access, so when I enter the period, am used to seeing the command list, and was very puzzled to see it no longer come up in LiveCycle, even though it did this morning.  I am having a terrible time over this button and do not know what I am doing wrong. I'm unable to add attachments here, not sure how or if they're allowing them yet.  Here is my revised JavaScript, though, as I said, the .rawValue was not an automatic list, I had to type it in manually.  Has anyone had this experience before?  If I remove the + PRQCompany.rawValue, the button works.  Otherwise, the message of instructions will pop up, but once you click 'OK', nothing else happens.

Thank you so much.

Avatar

Former Community Member

My guess is that the field PRQCompany is not in th e same context as the button where the script is running (look in the hierarchy view to see the structure). This is like accessing a file in a different directory, you must path your way to the object or it will not be found. If that does not work send the form to LiveCycle8@gmail.com and I will have a look.

Paul

Avatar

Former Community Member

Thank you, I have sent the form.  Checked the hierarchy but not sure what I'm looking for, it seems straightforward, but I'm very new to this.  Thank you for your kind help.

Avatar

Former Community Member

Thank you for checking out the form and letting me know about the path.  Since I had it in a table, you provided Table2.Row1.PRQCompany.rawValue, and it works like a charm to reference the right path.  This is very good to know up front, as I'm sure I'll be using tables where applicable, thank you for hanging till it was resolved, appreciate the help and instructions, it helps very much.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----