7 Replies Latest reply on May 9, 2016 8:51 AM by Karl Heinz Kremer

    Use this.submitForm() to submit emails based on user entry

    MADink_Designs27 Level 1

      I'm trying to use the this.submitForm() function to be able to allow users to send the form instead of the built in method due to different emails dependent on user entry of a text field.

       

      Below works—except that I want the pdf to be sent instead of the fdf data. I'm trying to get it to function using the cSubmitAs: input parameter, but can't seem to get the syntax right...

       

       

      if(manufacturer.value == "Manufacturer A") {
       this.submitForm(
        "mailto:name@address.com;name2@address.com?&cc=name@address.com;name2@address.com&subject=New Service Request Submittal"
        );
      }
      else {
       this.submitForm(
        "mailto:name@address.com;name2@address.com?subject=New Service Request Submittal"
        );
      }
      

      After doing a little research, I've come up with:

       

      var manufacturer = this.getField("manufacturer");
      var nEmail = "mailto:name@address.com;name2@address.com?&cc=name@address.com;name2@address.com&subject=New Service Request Submittal";
      var allEmail = "mailto:name@address.com;name2@address.com?subject=New Service Request Submittal";
      if(manufacturer.value == "Manufacturer A") {
       this.submitForm({nEmail, cSubmitAs: "PDF"});
      }
      else {
       this.submitForm({allEmail, cSubmitAs: "PDF"});
      }
      

       

       

      But I seem to be getting JavaScript errors no matter what I try...