Skip to main content
Inspiring
December 4, 2017
Answered

Popup window continues to popup

  • December 4, 2017
  • 1 reply
  • 628 views

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".

This topic has been closed for replies.
Correct answer SIPRNet11

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.

1 reply

Legend
December 4, 2017

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.

SIPRNet11Author
Inspiring
December 4, 2017

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.