4 Replies Latest reply on Dec 18, 2017 6:16 AM by SIPRNet11

    Popup window continues to popup

    SIPRNet11 Level 1

      Good morning.  I have field in a pdf form that reacts to another fields drop down selections.  I added some code with popup windows because there are questions that need to be asked before output can be completed.  The problem is that the popup window code is in the Custom Calculation Script box so every time I put information in other fields, it pops up...I'm assuming that it's recalculating every time there's change in the form.  How can I stop that from happening?  Here's my code:

      var v = this.getField("System Name").value;
      var vName = this.getField("01: Name").value;
      var vOrg = this.getField("02: Organization").value;
      var vTitle = this.getField("06: Job Title").value;
      
      if (v=='Select from the dropdown menu'){
       event.value = "";
      } else if (v=='NIPR'){
       event.value = "Needed for daily access supporting our operations.";
      } else if (v=='SIPR'){
       event.value = "Needed for daily access supporting our operations.";
      } else if (v=='NIPR and SIPR'){
       event.value = "Needed for daily access supporting our operations.";
      } else if (v=='NIPR Help Desk Administrator'){
       event.value = "Please create an IAT-I Elevated Privileges account for " + vName + ". They have met the DoD 8570.01M minimum training and certification requirements for elevated privileges at this level.  They are currently assigned to " + vOrg + " and will need Help Desk privileges for all workstations and notebooks.";
      } else if (v=='NIPR System Administrator'){
       event.value = "Please create an IAT-II System Administrator account for " + vName + ". They have met all DoD 8570.01M training and certification requirements for elevated privileges at this level.  They are currently assigned to " + vOrg + " as the " + vTitle + ". BOX 27 lists the security groups they will need to be added to.";
      } else if (v=='NIPR Network Administrator'){
       event.value = "Please create an IAT-II Network Administrator account for " + vName + ". They have met all DoD 8570.01M training and certification requirements for elevated privileges at this level.  They are currently assigned to " + vOrg + " as the " + vTitle + ". BOX 27 lists the security groups they will need to be added to.";
      /*
      } else if (v=='NIPR Portal Only' || v=='NIPR Portal and SIPR'){
      vValidResponse = 0;
      while(vValidResponse == 0){
      vQuit = 0;
      while(vQuit == 0){
      
      // Display Response Box
      var vPortJust = app.response("What is the name of the Operation or Exercise that you will be supporting?\n\nEXAMPLES Given:\nUNGA 2017, Hurricane Harvey, etc.","  BOX 13 - JUSTIFICATION FOR ACCESS");
      if(vPortJust == null){
      fExit();
      } else {
      vQuit = 1;
      }
      }
      if(vPortJust == ""){
         app.alert("INVALID ENTRY.\n\nYou must enter the name of the Operation or Exercise that you will be  supporting.",1,0,"  BOX 13 - JUSTIFICATION FOR ACCESS");
        vValidResponse = 0;
      } else {
      vValidResponse = 1;
      }
      }//ENTERING THE CONTRACT NUMBER
      vValidResponse = 0;
      while(vValidResponse == 0){
      vQuit = 0;
      while(vQuit == 0){
      // Display the Response Box
      var vPortExpDate = app.response("Enter the date (in yyyymmdd format) that you will no longer need the Portal Account.","  BOX 13 - JUSTIFICATION FOR ACCESS");
      if(vPortExpDate == null){
      fExit();
      } else {
      vQuit = 1;
      }
      }if(vPortExpDate == ""){
         app.alert("INVALID ENTRY.\n\nYou must enter an expiration date.",1,0,"  BOX 13 - JUSTIFICATION FOR ACCESS");
        vValidResponse = 0;
      } else {
      vValidResponse = 1;
      }
      }event.value = "Portal account needed for daily access supporting " + vPortJust + ".  They will need this Portal account until " + vPortExpDate + ".";
      */
      } else {}
      

       

      Honestly, the code in green is from someone else I "borrowed".

        • 1. Re: Popup window continues to popup
          Test Screen Name Most Valuable Participant

          That's what a calcuation script does; it's run every time any other field changes, so that you can have a field calculated from others, always rigtht. This may happen dozens or hundreds of times from a single click!

           

          The traditional place to put warnings about missing fields is when a button marked SUBMIT is pressed.

           

          When do you actually want this prompt to happen? Consider all the ways a user might tackle a form, including filling it out of order.

          • 2. Re: Popup window continues to popup
            SIPRNet11 Level 1

            I had a feeling that's what the calculation script was doing.  I have the form set up so when they select "NIPR Portal Only" or "NIPR Portal and SIPR", the popup window comes up asking them the two questions.  That's the ONLY time the popup should appear.

            • 3. Re: Popup window continues to popup
              SIPRNet11 Level 1

              I just changed everything and moved all the scripts into the one drop down field and out of the calculation script and into the custom validation script but now when an object is selected in the drop down, nothing is inputted in the other field.  Here's the new script I put in:

               

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

              var vName = this.getField("01: Name").value;

              var vOrg = this.getField("02: Organization").value;

              var vTitle = this.getField("06: Job Title").value;

               

              if (event.value=='Select from the dropdown menu'){

              vJustify = "";

              } else if (event.value=='NIPR'){

              vJustify = "Needed for daily access supporting our operations.";

              } else if (event.value=='SIPR'){

              vJustify = "Needed for daily access supporting our operations.";

              } else if (event.value=='NIPR and SIPR'){

              vJustify = "Needed for daily access supporting our operations.";

              } else if (event.value=='NIPR Help Desk Administrator'){

              vJustify = "Please create an IAT-I Elevated Privileges account for " + vName + ". They have met the DoD 8570.01M minimum training and certification requirements for elevated privileges at this level.  They are currently assigned to " + vOrg + " and will need Help Desk privileges for all workstations and notebooks.";

              } else if (event.value=='NIPR System Administrator'){

              vJustify = "Please create an IAT-II System Administrator account for " + vName + ". They have met all DoD 8570.01M training and certification requirements for elevated privileges at this level.  They are currently assigned to " + vOrg + " as the " + vTitle + ". BOX 27 lists the security groups they will need to be added to.";

              } else if (event.value=='NIPR Network Administrator'){

              vJustify = "Please create an IAT-II Network Administrator account for " + vName + ". They have met all DoD 8570.01M training and certification requirements for elevated privileges at this level.  They are currently assigned to " + vOrg + " as the " + vTitle + ". BOX 27 lists the security groups they will need to be added to.";

               

              } else if (event.value=='NIPR Portal Only' || event.value=='NIPR Portal and SIPR'){

              vValidResponse = 0;

              while(vValidResponse == 0){

              vQuit = 0;

              while(vQuit == 0){

              // Display Response Box

              var vPortJust = app.response("What is the name of the Operation or Exercise that you will be supporting?\n\nEXAMPLES Given:\nUNGA 2017, Hurricane Harvey, etc.","  BOX 13 - JUSTIFICATION FOR ACCESS");

              if(vPortJust == null){

              fExit();

              } else {

              vQuit = 1;}

              }if(vPortJust == ""){

                 app.alert("INVALID ENTRY.\n\nYou must enter the name of the Operation or Exercise that you will be  supporting.",1,0,"  BOX 13 - JUSTIFICATION FOR ACCESS");

                vValidResponse = 0;

              } else {

              vValidResponse = 1;}

              }//ENTERING THE CONTRACT NUMBER

              vValidResponse = 0;

              while(vValidResponse == 0){

              vQuit = 0;

              while(vQuit == 0){

              // Display the Response Box

              var vPortExpDate = app.response("Enter the date (in yyyymmdd format) that you will no longer need the Portal Account.","  BOX 13 - JUSTIFICATION FOR ACCESS");

              if(vPortExpDate == null){

              fExit();

              } else {

              vQuit = 1;}

              }if(vPortExpDate == ""){

                 app.alert("INVALID ENTRY.\n\nYou must enter an expiration date.",1,0,"  BOX 13 - JUSTIFICATION FOR ACCESS");

                vValidResponse = 0;

              } else {

              vValidResponse = 1;}

              }vJustify = "Portal account needed for daily access supporting " + vPortJust + ".  They will need this Portal account until " + vPortExpDate + ".";

              } else {}

              //This is a separate code running to that specific check boxes are selected.

              this.getField("15X: U").checkThisBox(0, (event.value=="NIPR" || event.value=="NIPR Portal Only" || event.value=="NIPR Help Desk Administrator" || event.value=="NIPR System Administrator" || event.value=="NIPR Network Administrator" || event.value=="NIPR and SIPR" || event.value=="NIPR Portal and SIPR"));

              this.getField("15X: C").checkThisBox(0, (event.value=="SIPR" || event.value=="NIPR and SIPR" || event.value=="SIPR Administrator" || event.value=="NIPR Portal and SIPR"));

              this.getField("15X: O").checkThisBox(0, (event.value=="NIPR Portal Only" || event.value=="NIPR Portal and SIPR"));

              this.getField("14X: Type of Access").value = "Off";

              this.getField("14X: Type of Access").checkThisBox(0, (event.value=="NIPR" || event.value=="NIPR Portal Only" || event.value=="NIPR and SIPR" || event.value=="NIPR Portal and SIPR" || event.value=="SIPR"));

              this.getField("14X: Type of Access").checkThisBox(1, (event.value=="NIPR Help Desk Administrator" || event.value=="NIPR System Administrator" || event.value=="NIPR Network Administrator" || event.value=="SIPR Administrator"));

              • 4. Re: Popup window continues to popup
                SIPRNet11 Level 1

                I fixed my problem.  I created a function to call at the document level.  So I was able to move the script out of the Custom Calculation Script.  Now I just have a function called in the Custom Validation Script and the popup doesn't appear anymore when I change the value in other fields.