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.

Advertisements

2 Responses to Prevent Page Advance on AutoSubmit in Report Studio Prompt Pages

  1. CognosPaul says:

    I have a slightly easier solution for you. Drag in a value prompt, set it to optional and to cascade from your radio. Then set box type to none. Cognos should detect that a prompt is cascading off the radio, so it won’t advance the page.

    • Bob Reddert says:

      Much easier, Paul. I’ll keep that in mind for future reports, however the one I was working on had more than 250 prompts (ghaaaaaa!), so writing this was easier than going through all the prompts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: