Expand my Community achievements bar.

SOLVED

E-mail Submit Button preSubmit event issues

Avatar

Level 2

I am working on a survey which contains an e-mail submit button.  When a user clicks the button, their survey should be tested for three conditions.  The first is that all of the mandatory questions have a response.  These responses are Yes/No radio buttons.  The second is that if the user has answered "No" to any of the first seven mandatory questions, they must submit a corrective action form.  A message box displays to inform the user that they must complete the corrective action form which became visible, as the last page of the survey, in the click event of the "No" radio button.  When the user has entered a response in the corrective action field and clicks the submit by e-mail button again, the survey should then allow them to complete the e-mail submission.  The following code is in the form's preSubmit action:

form1::preSubmit:form - (JavaScript, client)

if (CorrectiveAction.presence == "visible")

{

   if ((CorrectiveAction.rawValue == null) || (CorrectiveAction.rawValue == ""))

    {

      xfa.event.cancelAction = true;

      xfa.host.messageBox("Please fill in the Corrective Action section at the end of this form.");

    }

  }

I am encountering the following problems currently:

In Adobe Pro 9:

The e-mail submit function is not canceled if the user has not completed the corrective action form.

In Adobe Reader 9:

The e-mail submit button does not work at all, but the message box will display if the "No" radio button has been selected.

Any assistance you can provide would be greatly appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Change the type property to Button instead of Email Submit Button and set the Control Type to Submit.

In the Submit tab, set the Submit As to what ever is your requirement is.. XML/ PDF etc..

Submit by Email.jpg

Than place this code in the preSubmit event after all your validations are completed.

//Declare variables to hold the values

var strToAddress, strCCAddress, strSubject, strMessage

//Assign values to the above variables as required..

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

Sample is here..

https://acrobat.com/#d=pFyQRZ*C1TYAlU*8VOpV8A

Thanks

Srini

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Change the type property to Button instead of Email Submit Button and set the Control Type to Submit.

In the Submit tab, set the Submit As to what ever is your requirement is.. XML/ PDF etc..

Submit by Email.jpg

Than place this code in the preSubmit event after all your validations are completed.

//Declare variables to hold the values

var strToAddress, strCCAddress, strSubject, strMessage

//Assign values to the above variables as required..

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

Sample is here..

https://acrobat.com/#d=pFyQRZ*C1TYAlU*8VOpV8A

Thanks

Srini

Avatar

Level 2

Thank you so much for your assistance!