Expand my Community achievements bar.

Submit button and using form fields

Avatar

Former Community Member

Hello all, I'm a bit new to using LiveCycle.  I created a form in acrobat. I have all my fields working properly but I ran into a snag.  Seems as though people with reader can't open and fill in my form because of a saving issue.  So I figured... let's try LiveCycle. I opened the same form.

This is what I can figure out: I need a submit button that can attach the current pdf to a new email and then grab some of the field values from the form.  These field values are used to fill in the subject and the "To" field in outlook. I had a button that could do this in acrobat, but it doesn't seem to work in LiveCycle.  Can someone please offer some guidance?  Thanks so much.

This is what I had on the acrobat form that worked before LiveCycle if it helps at all (used from an adobe sample):

// This is the form return e-mail. Its hardcoded

   // The form will return to the manager chosen from the dropdown bob

   var cToAddr = "formsAdmin@BigCorp.com";

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

   var cCCAddr = this.getField("manager").value;

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

   var cBenAddr = this.getField("PlaceHolderEmail").value;

   // Get the name and req number

   var cName = this.getField("EmployeeName").value;

   var cNumber = this.getField("Department").value;

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

   var cSubLine = "Absence Notification - " + cName + " - " + cNumber;

   var cBody = "Thank you for submitting this form.\n" +

               "Save the mail attachment as a record";

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

   // Build the e-mail URL

   var cEmailURL = "mailto:" + cCCAddr + "?cc=" + cBenAddr

                 + "&subject=" + cSubLine

                 + "&body=" + cBody;

   this.submitForm({cURL: cEmailURL, cSubmitAs:"PDF", cCharSet:"utf-8"});

3 Replies

Avatar

Level 10

Here is a sample form for your reference..

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

You need to use the rawValue to get the field value in LiveCycle..

for example

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

     var cCCAddr = manager.rawValue;

Thanks

Srini

Avatar

Former Community Member

Thank you so much for your response.  Does the rest remain the same? Can I use " this.submitForm({cURL: cEmailURL, cSubmitAs:"PDF", cCharSet:"utf-8"});" in LiveCycle?

Thanks Again

Nelson

Avatar

Former Community Member

Hi again,

So I opened your doc in LiveCycle and I saw the code you used for the submit button... thanks so much for that.

I run into one error and the same happens with your sample.  Right after I click submit, I get a notification popup "Submit Cancelled"... in some cases it actually sends and in others it doesn't.

I have this now:

********************************************************

topmostSubform.Page1.Button1::preSubmit:form - (JavaScript, client)

var strToAddress

strToAddress = manager.rawValue;

strSubject = "Absence Notification - " + EmployeeName.rawValue + " - " + Department.rawValue;

strMessage = Message.rawValue;

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

********************************************************

Thanks again

Nelson