2 Replies Latest reply on Jun 14, 2016 4:14 PM by SPM_Mreilly

    Remove value from exported values

    SPM_Mreilly Level 1

      I have created a PDF Form. I am pulling the values from the form to display in a text box using the following code:

       

      event.value = this.getField("Company/DBA").value + this.getField("State").value + this.getField("name&lic").value + this.getField("Address").value + this.getField("Phone").value +  this.getField("MAbroker").value + this.getField("NYbroker").value + this.getField("LicenseLookup").value +  this.getField("RealEstateAd").value +  this.getField("RatesTerms").value +  this.getField("NotAllBorrowers").value +  this.getField("MarketConditions").value +  this.getField("BorrowerQual").value +  this.getField("NotACommit").value +  this.getField("MaxLoanAmount").value +  this.getField("GovSponsProd").value +  this.getField("ARM").value +  this.getField("RefiAd").value +  this.getField("TargetAd").value +  this.getField("TaxDeductibility").value +  this.getField("BrokeredProduct").value +  this.getField("ReverseMortgage").value;

       

      The issue I am having is that I have some of this form fields set as a drop down list where the user can select yes or no. If the user selects yes, then I have a sentence that is pulled as the export value. When the user selects No, the No defaults as the export value. When I end up with is a string of text that has a bunch of No's in it...

       

      What I want to do is have the user select no and have the export value be nothing. I tried putting in a space as the Export Value, but then I end up with random spaces in the line of text.

       

      I think an if/then statement is probably the best solution, but due to my limited experience with javascript, I am not having much success on getting this to work.

       

      Additional Information: I tried doing the same thing with check or radio buttons and I was having a similar outcome.

        • 1. Re: Remove value from exported values
          Karl Heinz Kremer Adobe Community Professional

          You can certainly do that with an if statement, and by breaking the check for the "No" value out of the long assignment statement you have. Let's assume you have a field named "IsThisNo", and want that added to the first line of your long assignment. I would do this as follows:

           

          var isThisNo = this.getField("IsThisNo").value;
          if (isThisNo == "No") {
            isThisNo = "";
          }
          
          event.value = this.getField("Company/DBA").value + this.getField("State").value + isThisNo +
          ... and here comes the rest of your statement ...
          

          As you can see, I check to see if the value of the field IsThisNo is "No", and if it is, I assign an empty string to it, otherwise I leave it unchanged.

          • 2. Re: Remove value from exported values
            SPM_Mreilly Level 1

            Am I to assume then that I would have to set this variable up for each field?

             

            in essence:

             

            event.value =

            var isThisNo = this.getField("Company/DBA").value;

            if (isThisNo == "No") {

            isThisNo = "";

            }

             

            Correct?

             

            Also, this will work no matter what I choose to have it look for? Such as "Off" or " "? Correct?

             

            Thank you,

             

            Michael