Prevent Page Advance on AutoSubmit in Report Studio Prompt Pages

Recently we had a Report Studio prompt page with a number of prompts including some radio buttons. When a radio button was selected, the prompt page needed to be automatically refreshed. The problem is that Auto-Submit would advance to the report page.

The solution was to add a hidden text box prompt with “Require” set to “Yes” and then to replace the Next and Finish buttons with Javascript that would set the value of the required prompt before performing the Next or Finish function.

To accomplish this we needed 4 HTML items, a text box prompt with Required=Yes, and a fifth HTML item:
Prevent Page Advance on AutoSubmit in Report Studio Prompt Pages Fig01

 

Here’s the Javascript:

Next button
<div class="clsPromptComponent" pt="btn">
<BUTTON 
  class="bp" 
  type="button"
  onclick="getElementById('divPage1Complete').getElementsByTagName('input')[1].value=1; 
    promptButtonNext();"
  onmouseover="this.className = 'bp bph'"
  onmouseout="this.className = 'bp'"
>Next
</BUTTON>
</div>
Finish Button
<div class="clsPromptComponent" pt="btn">
<BUTTON 
  class="bp" 
  type="button"  
  onclick="getElementById('divPage1Complete').getElementsByTagName('input')[1].value=1; 
    promptButtonFinish(); " 
  onmouseover="this.className = 'bp bph'" 
  onmouseout="this.className = 'bp'" 
>Finish
</BUTTON>
</div>
Reset
<script>
  while( !alert) {}
  setTimeout( function() {
    document.getElementById('divPage1Complete').getElementsByTagName('input')[1].value="";
  } , 1000)
</script>
(the text box prompt goes here)
Prompt Opening Div
<div id="divPage1Complete" style="display:none;">
Prompt Closing Div
</div>

This way, the report will not leave this page until the user clicks the custom Next or Finish button.