COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Adalberto on 21 Dec 2016 11:41:38 PM

Title: HTML item with Javascript disappears...
Post by: Adalberto on 21 Dec 2016 11:41:38 PM
Hi everyone:

I'm having a problem and I'm going to explain it in detail.

I'm using a prompt page and some report pages. In the prompt page I have the following:
1. An HTML item with this code <p>Date: <input type="text" id="datepicker" onchange ="myFunction(this.value)"  /></p>
2. An HTML item with datepicker libraries scripts.
3. An HTML item with jQuery script to give interaction to the input type (point 1.).
4. A text box promt for my parameter.
5. An HTML item to save the input type value into the text box prompt.

When I run the report it works fine, I have the datepicker interaction and I can go from the prompt page to the report page.

In the report page I have a prompt button to go back to the prompt page.

Here is where I have the trouble. I have the input type and the text box prompt, but without interaction and the datepicker is not displayed.

Inspecting the HTML source (right click, Inspect[Ctrl+Shift+I]]) my javascript code has disappeared (points 2. 3. and 5.).

I have no idea why this happens, if anyone could help me I would appreciate it.

Thanks in advance.
Title: Re: HTML item with Javascript disappears...
Post by: SpareTire on 28 Dec 2016 08:42:03 PM
Hi,

I know the problem your talking about because whenever I add J/S to the prompt page and try to go back to it from the report page it gets screwy. All I can do is surmise that it has something to do with the page refreshing and that there is a difference between hitting back/reprompt and clicking the actual report.

My workaround has been instead of using the back/reprompt/play button in toolbar was to create my own button using javascript to insert a button  to "return to prompt" that was in fact just rerunning the report using its CAMID Direct URL. Effectively the button was the same as pressing back and hitting the report again, enabling your custom HTML.

Look up the reports direct URL in its properties, and insert this as an HTML item into the report header or footer:

<input type=button onClick="location.href=' CAMID DIRECT URL HERE '" value='Return To Prompt'>