1 Reply Latest reply on Apr 2, 2008 9:59 AM by Patrick Leckey

    set FDF file path

    Level 1
      Greetings,

      I have created a form that checks if fields are complete and if so, attaches a FDF file to an email.
      Here is my code:

      var f1 = this.getField("0_type").value;
      var rFields = new Array(
      ["0_type", "Form Type"],
      ["1_account_number", "Account Number"],
      ["1_name_sale_source", "Your Name and Sales Source Number"],
      ["1_pu_facility", "Pickup Facility"],
      ["1_territory", "Pickup Territory"],
      ["3_billing_name", "Billing Contact Name"],
      ["3_company_name", "Billing Company Name"],
      ["3_phone", "Billing Contact Phone"]);

      if(f1 == "re")
      {
      function FormComplete()
      {
      var bComplete = true;
      var errMsg = "";
      RemoveHighlights(["0_type", "1_account_number", "1_name_sale_source", "1_pu_facility", "1_territory", "3_billing_name", "3_company_name", "3_phone"]);
      for (i = 0; i < rFields.length; i++)
      {
      if
      (this.getField(rFields[i][0]).valueAsString == " ")
      {
      bComplete = false;
      errMsg = errMsg + rFields[i][1] + "\n";
      this.getField(rFields[i][0]).fillColor = color.red;
      }
      }
      if (bComplete != true)
      {
      app.alert("The following field(s) need to be completed for a Reactivation request:\n\n" + errMsg,
      1, 1);
      }
      return bComplete;
      }
      function RemoveHighlights(aFields)
      {
      console.println(aFields.length);
      for (i = 0; i < aFields.length; i++)
      this.getField(aFields[i]).fillColor = color.transparent;
      return;
      }
      if(FormComplete())
      this.submitForm({cURL:"mailto:abcde@abcde.com?subject=Reactivation Request for "+this.getField("3_company_name").value+" #"+this.getField("1_account_number").value+"&body=Thank you for completing this form.%0A%0AReactivation requests require management approval. Once approval is granted your request will be processed.%0A%0AThank you,%0ASales Support Team&bcc=otasfd@abcde.com"});
      }

      Here's my problem:

      Users are saving the source file in different locations on their hard drives. And, some times they rename their files for future reference. When the exported FDF file arrives it is looking for that source file in the obscure location and when it doesn't find it, prompts the user to locate the file for it. We then navigate to the correct file and the FDF opens correctly.

      Here's my question:

      Using javascript, can I set a specific file path and file name that the FDF will look for when opened? In other words, if a user saves the file in some obscure place with a weird name (like XYZ), the FDF will always look for ABCD file on the desktop.

      Possible? If so, please kindly post a sample script.

      Thx,
      rob
        • 1. Re: set FDF file path
          Patrick Leckey Level 3
          Not with the submitForm() method.<br /><br />You could use var myFDF = app.newFDF() then set the /F tag with myFDF.addEmbeddedFile(<path>);<br /><br />The only problem is that newFDF() is a security-restricted method so you cannot use it in document-level JavaScript, only folder-level.  If your workflow requires that you use document-level JavaScript then you will not be able to overwrite the /F tag in the FDF generated by submitForm() using any SDK methods.