4 Replies Latest reply on Jan 5, 2018 9:12 AM by Thom Parker

    Reset a dropdown menu to default in PDF form

    SIPRNet11 Level 1

      I have a drop down field in a PDF form.  When a user selects from the drop down, a popup window appears asking additional questions and those answers are inputted into another field.  If they click cancel another window pops up asking if they're sure to cancel.  If they click the YES button, I want the drop down field to revert back to the default selection.

       

      I'm running two functions.  One is in the drop down's custom validation window called (fSystemRequest) and the other is called (fExitPortalSelect) that is running inside the (fSystemRequest) function.  So if they select YES or try to "X" out of the window, the (fExitPortalSelect) function is ran.  Here's the (fExitPortalFunction) code I have:

       

      function fExitPortalSelect() {

          var vQuitPortalSelect = app.alert("Are you sure you want to quit?\n\nYou will not be able to gain access to the network until you answer these questions.\n\nClick 'Yes' to quit or 'No' to continue filling in the information required.",2,2);

          if(vQuitPortalSelect == "4") {

              this.getField("13: Justification").value = "";

              this.getField("System Name").reset = "Select from the dropdown menu";

              response.end;

          }

      }

       

      The line that's bold is the one I'm working on.  I've tried several different ways.  Please help...

        • 1. Re: Reset a dropdown menu to default in PDF form
          try67 MVP & Adobe Community Professional

          You can't just invent commands and hope they will work... If you want to reset a field to its default value you can either use the resetForm method of the Document object (specifying that field's name as the input parameter) or apply the field's defaultValue property to its value property.

          • 2. Re: Reset a dropdown menu to default in PDF form
            SIPRNet11 Level 1

            Morning Gilad,

             

            I added a function:

            fResetDropDown() {

               this.getField("System Name").reset();

            }

             

            And called that function inside the other function that I mentioned above.  It completes this.getField("13: Justification").value = ""; when I click the YES button but the fResetDropDown still doesn't work.  Did I input the line correctly?  I wasn't sure what you meant by "specifying that field's name as the input parameter".  Do you mean when I put in "this.getField("System Name")"?

             

            The dropdown menu is set up where the text "Select from the dropdown menu" is the default text when the form is initially opened.  When other text is selected but the user decides to cancel when asked in the popup window, the dropdown menu stays with the text they selected and does not "default" to "Select from the dropdown menu".

            • 3. Re: Reset a dropdown menu to default in PDF form
              try67 MVP & Adobe Community Professional

              Again, there's no such thing as a reset method. Do you want to revert this field to its default value?

              If so, use this code:

              this.resetForm(["System Name"]);

              • 4. Re: Reset a dropdown menu to default in PDF form
                Thom Parker Adobe Community Professional

                Or you could use this code to reset only the field

                this.getField("System Name").value = this.getField("System Name").defaultValue;

                1 person found this helpful