COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: rr.bi1212 on 26 Dec 2016 09:52:32 PM

Title: Prompts
Post by: rr.bi1212 on 26 Dec 2016 09:52:32 PM
I have 2 prompts in the report...the user needs to select either of the prompt and click finish button. The prompt filter cannot be optional...it has to be required.Both are text box prompts.
So until one of the prompt is entered the finish button should not be enabled...please help.
Title: Re: Prompts
Post by: SpareTire on 27 Dec 2016 07:11:36 AM
Hi,

I am not sure the statement sounds logical to me. If Prompt#1 & Prompt#2 are both required, and User fills in Prompt#2 ---how would cognos know what to fill in Prompt#1 without the user?

Sounds like a Dr.Suess riddle....

Sounds like you need both prompts to be optional but you dont want the finish button to be available until at least one of the prompts are filled.
Title: Re: Prompts
Post by: rr.bi1212 on 27 Dec 2016 09:43:35 AM
Yeah....what I need is finish button should jot be enabled until one of them is entered ifthe prompts are optional.
Title: Re: Prompts
Post by: SpareTire on 03 Jan 2017 10:48:07 AM
I came across a solution doing something else. You delete the finish button provided by cognos, insert your own finish button and then create a function that checks the value of each text box to either submit it or alert the user.

Here is the J/S for the function;


<script type="text/javascript">
function validate()
{
var fW = (typeof getFormWarpRequest == "function" ?getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)
{ fW = ( formWarpRequest_THIS_ ?formWarpRequest_THIS_ : formWarpRequest_NS_ );
}

var Textbox1 = fW._textEditBoxTextbox1.value;
var Textbox2 = fW._textEditBoxTextbox2.value;

if ((Textbox1 == '') && (Textbox2 == ''))
{alert('At least one prompt must be filled');}
else
{promptAction('finish');}
}
</script>


Then delete the Cognos finish button and insert your own into the footer:


<input type="button" onclick="validate()" value="Finish"/>



Don't forget to name your text boxes: Textbox1 and Textbox2