Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Submit by Email to two URLs at runtime

Avatar

Level 4

I have a form with a Submit by Email button configured in the Object palette to send the form to a specific URL. In the form, the user fills out an email address text field. Is it possible to send the user the form also? I found something close (see below). I tried to adapt this by adding script to the Submit by Email button this way:

this.resolveNode("#event").submit.target = "mailto:somebody@somewhere.com; " +emailFromTxt .rawValue + "?subject=email data&body=This is the body  text.";

but that doesn't work. Thank you for any suggestions on whether this is possible or not.

Script - validate event of TextField1

var address = new RegExp();
address.compile("^[a-z0-9_\\-\\.]+\\@[a-z0-9_\\-\\.]+\\.[a-z]{2,3}$","i");
var result = address.test(this.rawValue);
if (result == true){
  true;
} else {
  false;
}

Script - click event of the email button

this.resolveNode("#event").submit.target = "mailto:" + TextField1.rawValue + "?subject=email data&body=This is the body text.";

( from: http://partners.adobe.com/public/developer/en/livecycle/designer/pdfs/FieldSubmitURL.pdf)

1 Accepted Solution

Avatar

Correct answer by
Level 10

This is the changed script that you have used..

this.resolveNode("#event").submit.target = "mailto:somebody@somewhere.com; " + emailFromTxt .rawValue + "?cc=" + strCCAddress + "&subject=email data&body=This is the body  text.";

If the above script does not work, try the below script to send CC Email Address.

var strToAddress, strCCAddress, strSubject, strMessage

strToAddress = "YourEmailAddress@YourCompany.com";
strCCAddress = "YourCCEmailAddress@YourCompany.com";

strSubject = txtSubject.rawValue;

strMessage = txtMessage.rawValue;

event.target.submitForm({cURL:"mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + strSubject + "&body=" + strMessage,cSubmitAs:"PDF",cCharset:"utf-8"});

Thanks

Srini

View solution in original post

0 Replies

Avatar

Level 10

Check this sample..

https://acrobat.com/#d=CK4QgXn38l49bzQlhWtKSA

You can concatenate two addresses separated by ";" to send to two email addresses.

Thanks

Srini

Avatar

Level 4

Actually, this does work.

this.resolveNode("#event").submit.target = "mailto:somebody@somewhere.com; " + emailFromTxt .rawValue + "?subject=email data&body=This is the body  text.";

Is there a way to make the second URL (the emailFromTxtfield) as CC or BCC?

Avatar

Correct answer by
Level 10

This is the changed script that you have used..

this.resolveNode("#event").submit.target = "mailto:somebody@somewhere.com; " + emailFromTxt .rawValue + "?cc=" + strCCAddress + "&subject=email data&body=This is the body  text.";

If the above script does not work, try the below script to send CC Email Address.

var strToAddress, strCCAddress, strSubject, strMessage

strToAddress = "YourEmailAddress@YourCompany.com";
strCCAddress = "YourCCEmailAddress@YourCompany.com";

strSubject = txtSubject.rawValue;

strMessage = txtMessage.rawValue;

event.target.submitForm({cURL:"mailto:"+ strToAddress + "?cc=" + strCCAddress + "&subject=" + strSubject + "&body=" + strMessage,cSubmitAs:"PDF",cCharset:"utf-8"});

Thanks

Srini

Avatar

Level 4

Also, is there a way to send a specific subject at runtime, maybe something like this?

this.resolveNode("#event").submit.target = "mailto: somebody@somewhere.com; " + emailFromTxt.rawValue + "?subject=Request from" + firstNameTxt.rawValue + middleInitialTxt.rawValue + lastNameTxt.rawValue + "&body=This is the body text.";

Avatar

Level 4

And in a similar way, how could I change the body text of the email to include some of the fields from the form?

Avatar

Level 10

If you look at the sample code I provided earlier, I am using local variables tohold the Subject and Message text. I am taking the values from two different fields on the form. You can change it to get the message from multiple text fields and conmbine them.

     strMessage = txtMessage1.rawValue + txtMessage2.rawValue + txtMessage3.rawValue;

Similarly if you do not want the Subject to appear in the email, then set the strSubject to ""..

     strSubject = "";

Hope this helps.

Thanks

Srini

Avatar

Level 4

This code works and sends a PDF, which is desirable. However, something strange happens. When

I click on Submit by Email, the dialog for sending the email comes up, then the email itself. After I click

Send, another email dialog comes up, and when I click that, I get an email with a CC and the attachment is

XML, rather than PDF. Can you try your code in LiveCycle ES2 and see if the same thing happens?

Avatar

Level 10

Send your form to LiveCycle9@gmail.com so I can have a look at it..

Not sure what is going wrong.. The form I send you works fine in ES and ES2..

Thanks

Srini