I've seen other people post this question, but cannot find an answer. When a user completes and submits a form created in LiveCycle and distributed as a saved file (as opposed through Adobe) an email is generated that has the completed form attached and the following in the body of the email:
Instructions to add this form to a responses file:
1. Double-click the attachment.
2. Acrobat will prompt you to select a responses file.
THE PERSON FILLING OUT THE FORM DOESN'T NEED TO SEE THIS! How can the body of the message be changed to read something like, "Thank you for accepting my information, I look forward to seeing the results." or ANYTHING but the above, which is just confusing to the person completing the form??
Thanks - I have spent a couple of hours researching this and can find no answer.
TK
Views
Replies
Total Likes
Hi,
There are a number of ways to set up an email submit button, including using a Submit button, using a Regular button with its type set to submit or using a Regular button and having a custom script in the click event. The first two options will submit the data but are not fully customisable.
I have two examples, one for users with Acrobat/Reader v9.1 (this uses the new validationState event and the cancelAction method) and a second that is suitable for older versions of Acrobat/Reader.
http://www.assuredynamics.com/index.php/category/portfolio/email-script-v9-and-above/
http://www.assuredynamics.com/index.php/category/portfolio/email-script-v8-and-below/
In both cases you are interested in the last email submit button. Please note that this is using multiple features in building the email script. You only need to use the parts of the solution that you need.
Hope that helps,
Niall
Views
Replies
Total Likes
Thanks, Niall:
As you stated, the first two button types (regular, control type = submit and the email submit button) don't allow you to edit the body of the email the user has once they submit the form. (On a side note, I am using manual distribution by saving the form and sending it to the user. They submit and it goes to my inbox. The issue is with the message in the body of the email they send to me with the submitted form).
Your third option (Regular Button, Control Type = Regular) seems like a good idea, but I couldn't find on your document how to set the parameters. Is that the custom script you described below the explanation?
I should also mention that I have no experience with writing script, so, at the risk of overstaying my welcome - what would you recommend?
Terry
Views
Replies
Total Likes
No problem Terry!!
Below the third email button is a textfield that displays the script. You can scroll up and down and examine it:
This example is a bit involved, so I will try and break it down into sections:
You can see the textfields on the form for the name, email address, message, etc. The script looks at the value in these fields and uses this in the email script.
It can help to set up script variables. These are temporary holding points for values. These only exist for that script. For example vEmail, which will hold the email address.
// First check if there are null values, then construct email using script
var vEmail;
var vSubject;
var vBody;
var vName;
var vCC = "";
var vFormat = subFormat.rawValue;
var errorMessage = "You have not provided enough information:";
The next section is a bit long. It basically works through all of the fields to make sure that they are not null. If they are then it adds to the error message. Otherwise it sets the value of the relevant variable to the value of the associated field. You will see the same approach being used for each field.
// Check email address field and build error message
if (emailAddress.rawValue == null)
{
errorMessage = errorMessage + "\n - please provide an email address.";
}
else
{
vEmail = emailAddress.rawValue;
}
// Check if there is a cc email address inputted
if (ccEmail.rawValue != null)
{
vCC = "&cc=" + ccEmail.rawValue;
// vCC is put at the end of the mailto string because it starts with a &
}
// Check subject line field and extend error message
if (subjectLine.rawValue == null)
{
errorMessage = errorMessage + "\n - please provide a subject line.";
}
else
{
vSubject = subjectLine.rawValue;
}
// Check your name field and extend error message
if (yourName.rawValue == null)
{
errorMessage = errorMessage + "\n - please provide your name.";
}
else
{
vName = yourName.rawValue;
}
// Check message line field, if null build a custom body message
if (messageLine.rawValue == null)
{
vBody = "Hi " + recipient.rawValue + ", \n\nThis email contains our submission in " + subFormat.rawValue + " format. \n\nPlease double click the attachment to open our submission. \n\nRegards, \n\n" + vName;
}
else
{
vBody = messageLine.rawValue;
}
We are nearly ready to send out the email. The last if statement checks that the minimum fields are not null. If any of the fields are null, then it displays the error message. Note that in the if statement the pipe (||) is JavaScript for OR.
// If fields required for script are null, warn user and do not initiate email
if (emailAddress.rawValue == null || subjectLine.rawValue == null || yourName.rawValue == null)
{
xfa.host.messageBox(errorMessage, "Sending an email", 0, 0); // Send out a custom error message if any of these fields are null
}
else
{
// Everything is OK, send email
event.target.submitForm({cURL:"mailto: "+ vEmail +"?subject=" + vSubject +"&body=" + vBody + vCC,cSubmitAs:vFormat,cCharset:"utf-8"});
}
That's it!!!!
The last line is the event.target.submitForm, which follows strict syntax for the variables. You can see that we are using the variables for the values.
This script is in the click event of the submit button. You can view the script in the Script Editor. If this is not visible at the top of the LC Designer window, then you can access it from the Windows menu. If it is only one line high, then grab the bottom bar and make it bigger. You need to see about 10 lines at a time.
The script is a bit involved, but don't be put off, there are a few methods here which are worthwhile exploring.
Come back if you need help,
Niall
Views
Replies
Total Likes
Niall:
Thanks, again! I found the script before. My problem is I don't know what to do with it! As I said, I have no training in that area. Do I just click on the button, open the script editor and paste the script into the editor? And once in there, I am not sure I know exactly how to edit to suit. What do you recommend?
P.S. I will be away from my desk for a few hours. Thank you again for your help.
Terry
Views
Replies
Total Likes
Hi Terry,
If you want to contact us directly we will try and help: http://www.assuredynamics.com/index.php/contact/
Niall
Views
Replies
Total Likes
Views
Likes
Replies