9 Replies Latest reply on Aug 31, 2017 12:42 PM by try67

    Submit Button Action

    TCIchris Level 1

      I have an editable .pdf form that has a Submit button with a Java script running to send the completed form to a specific email address in our company.  I need to change the email address to another.  I have changed the script to the appropriate email address but that does not change the function on the form, it still submits the old form name to the old address.  It is possible that the script is not running, but where else would it be getting its direction from?  I am unable to see where else this data should be changed.  Please HELP!

        • 1. Re: Submit Button Action
          try67 MVP & Adobe Community Professional

          That's strange... Is the "Run a JavaScript" command the only one associated with the field?

          • 2. Re: Submit Button Action
            TCIchris Level 1

            Yes, as far as I can see.

            • 3. Re: Submit Button Action
              try67 MVP & Adobe Community Professional

              Can you share the file in question with us (via Dropbox, Google Drive, Adobe Cloud, etc.)?

              • 4. Re: Submit Button Action
                TCIchris Level 1

                • 5. Re: Submit Button Action
                  try67 MVP & Adobe Community Professional

                  Can you post the code you're using?

                  • 6. Re: Submit Button Action
                    TCIchris Level 1

                    Here is the Java script that was created for this document.  Unfortunately, I am not the creator and I only know enough about code to find and replace items but not really read it nor write it.  

                     

                    The original email address said Gina@#####.com  and I changed it to jobs@####.com and I changed Submitting Completed Form to Submitting Completed Application.

                     

                     

                     

                     

                    //@@SUBMITURL "mailto:jobs@#####.com?subject=Submitting Completed Application&body=Instructions to add this form to a responses file:\n1. Double-click the attachment.\n2. Acrobat will prompt you to select a responses file.&ui=false"

                     

                    /**************************************************************

                    AdobePatentID="B643"

                    **************************************************************/

                    var AdobePatentID = "AdobePatentID=\"B643\"";

                     

                    // initiate some constants

                    var METADATA_ANNOT_NAME     = "adhocFormState";

                    var PROP_RESPONDENT_NAME    = "respondentName";

                    var PROP_RESPONDENT_EMAIL   = "respondentEmail";

                     

                    var currentDoc;

                    if (typeof(xfa) == "object")

                        currentDoc = event.target;

                    else

                        currentDoc = this;

                     

                    // Only on Viewer/Reader older than 9.0, we'll do the following tasks.

                    var bAnonymous = false;

                    var bContinue = true;

                    if (app.viewerVersion < 9.0) {

                     

                        // show the email/name dialog if not anonymous

                        if (!bAnonymous && !currentDoc.dynamicXFAForm) {

                            var result = currentDoc.askUserIdentity(currentDoc);

                            if (result == null)

                                bContinue = false;

                            else {   

                                var annot = currentDoc.getAnnot(0, METADATA_ANNOT_NAME);

                                if (annot != null) {

                                    var arrProps = new Array();

                                    arrProps = annot.contents.split(";");

                                    currentDoc.setProperty(arrProps, PROP_RESPONDENT_NAME, result.name);

                                    currentDoc.setProperty(arrProps, PROP_RESPONDENT_EMAIL, result.email);

                                    annot.contents = arrProps.join(";");

                                }

                            }

                        }

                       

                        // show the select client dialog

                        if (bContinue) {

                            var result = currentDoc.askEmailClient(currentDoc);

                            if (result == null)

                                bContinue = false;

                            else if (!result.send)  {

                                app.execMenuItem("SaveAs");

                                bContinue = false;

                            }

                        }

                    }

                     

                    // submit the form

                    if (bContinue) {

                        var rawURL = "jobs@#####.com?subject=Submitting Completed Application&body=Instructions to add this form to a responses file:\n1. Double-click the attachment.\n2. Acrobat will prompt you to select a responses file.&ui=false";

                        var submitURL;

                        if (app.viewerVersion < 9.0)

                            submitURL = "mailto:" + rawURL;

                        else

                            submitURL = "mailto:" + escape(rawURL);

                        currentDoc.submitForm({

                            cURL: submitURL,

                            cSubmitAs: "PDF"

                        });

                    }

                    • 7. Re: Submit Button Action
                      try67 MVP & Adobe Community Professional

                      Not sure what to tell you... It seems fine.

                      • 8. Re: Submit Button Action
                        TCIchris Level 1

                        Yes, it didn't make sense to me, hence the plea for help!

                        Thank you for trying anyway. 

                        • 9. Re: Submit Button Action
                          try67 MVP & Adobe Community Professional

                          Can you share the actual file?