Skip to main content
Known Participant
August 21, 2023
Question

Bad parameter message when selecting drop down with JavaScript to spawn/delete pages

  • August 21, 2023
  • 4 replies
  • 1948 views

I have a drop down field that will spawn page templates based on the drop down selection. If the user changes their selection, the previsouly-spawned template pp. will be deleted and new template pp. will spawn. This works well, but sometimes a "Bad parameter" message will pop-up when a new selection is made. The function still works (the proper pages will still spawn/delete), but the message pops up. I don't have any JavaScript errors and cannot find a consistant reason why this message will pop up (I can go through several choices/changes without any bad parameter messages and then the message will pop up--but still delete/spawn correctly-- and then it won't pop up on the next selection or maybe will pop up on several selections in a row). Does anyone know what could be causing this message to pop up and/or how to stop it? Any input would be greatly appreciated. 

 

FYI: I've also searched and tried other troubleshooting tips including removing tags (there are none in the file)

This topic has been closed for replies.

4 replies

JR Boulay
Community Expert
Community Expert
August 23, 2023

Try this script, I added 2 lines at the beginning to display only the first page before its execution:

 

if(event.willCommit)
{
this.pageNum = 0;
this.zoomType = zoomtype.fitP;

switch(event.value)
{
case "Closely Held Business":
this.getTemplate("RVW-T1 CHB").spawn(this.numPages,false, false);
this.getTemplate("RVW-T2").spawn(this.numPages,false, false);

break;
case "ILIT":
this.getTemplate("RVW-T1 ILIT").spawn(this.numPages,false, false);
this.getTemplate("RVW-T2").spawn(this.numPages,false, false);

break;
case "Mortgage/Note/Loan":
this.getTemplate("RVW-T1 MNL").spawn(this.numPages,false, false);
this.getTemplate("RVW-T2").spawn(this.numPages,false, false);

break;
case "Real Estate":
this.getTemplate("RVW-T1 RE").spawn(this.numPages,false, false);
this.getTemplate("RVW-T2").spawn(this.numPages,false, false);


break;
}

} else if (numPages > 1) {

this.deletePages(1, this.numPages-1);

}

Acrobate du PDF, InDesigner et Photoshopographe
Inspiring
August 23, 2023

Thank you for your help. Unfortunately, this does not eliminate the problem. If the user's screen is showing any portion of the next page, the "Bad parameter." message still pops up. As before, the proper pages are deleted/spawned, even with the message popping up.

Inspiring
August 22, 2023

I have found what causes the "Bad parameter." message to pop up and why it only happens sometimes. The trigger drop down field is toward the bottom of page 1. If the user is makes the new selection when a portion of the next page is showing (in this document, the next page would always be a spawned template page), the "Bad parameter." message pops up. If only page 1 is showing, then the message does not pop up. In both cases, the form deletes/spawns the correct pages. Now that we know what is causing the issue, is there any way to prevent the "Bad parameter." message from popping up so that the end user will not be confused/concerned?

Bernd Alheit
Community Expert
Community Expert
August 23, 2023

May be that the bad parameter is at one of the template pages.

JR Boulay
Community Expert
Community Expert
August 22, 2023

In which action/trigger/event did you place this script?

Acrobate du PDF, InDesigner et Photoshopographe
slaronAuthor
Known Participant
August 22, 2023

The script for the spawning/deleting of template pp. is a Custom Keystoke Script in the drop down. "Commit selected value immediately" is selected in the drop down's Option tab. There is also a Custom Validation Script for the drop down to make fields visible/hidden based on selection as well as reset fields.

 

Here is the Custom Keystroke Script that spawns/deletes the template pp.:  

if(event.willCommit)
{
   switch(event.value)
   {
      case "Closely Held Business":
           this.getTemplate("RVW-T1 CHB").spawn(this.numPages,false, false);
   this.getTemplate("RVW-T2").spawn(this.numPages,false, false);
 
          break;
      case "ILIT":
           this.getTemplate("RVW-T1 ILIT").spawn(this.numPages,false, false);
           this.getTemplate("RVW-T2").spawn(this.numPages,false, false);
 
          break;
      case "Mortgage/Note/Loan":
           this.getTemplate("RVW-T1 MNL").spawn(this.numPages,false, false);
           this.getTemplate("RVW-T2").spawn(this.numPages,false, false);
 
          break;
      case "Real Estate":
           this.getTemplate("RVW-T1 RE").spawn(this.numPages,false, false);
           this.getTemplate("RVW-T2").spawn(this.numPages,false, false);
 
 
          break;
    }
 
} else if (numPages > 1) {
 
     this.deletePages(1, this.numPages-1);
 
}

Please let me know if you need any more information

Bernd Alheit
Community Expert
Community Expert
August 22, 2023

Post a screenshot of the popup.

slaronAuthor
Known Participant
August 22, 2023

slaronAuthor
Known Participant
August 22, 2023

As stated previously, even when this does pop up, when you hit "OK" the form functions as intended. Sometimes (rarely) after you hit the "OK" button the drop down stays on the previous selection and you have to make your new choice again. When you make the choice again the form functions as intended and the Bad parameter message does not pop up.

I hope this is helpful.