1
votes

I'm a Cognos Developer and I'm having a trouble about "Date Prompts". I have a "Date Prompt" with the option "Edit box" selected in the "Select UI" and I want when the user change the chosen date an "onchange" event fires. Now I'm using JavaScript functions but I'm not getting do this... and just the "onchange" event don't work. I tested with another events like "onclick" and them work. My code:

<script>

var fW = (typeof getFormWarpRequest == "function" ?getFormWarpRequest() : document.forms["formWarpRequest"]);

if ( !fW || fW == undefined) { 
   fW = ( formWarpRequest_THIS_ ?formWarpRequest_THIS_ : 
   formWarpRequest_NS_ );
}

fW.txtDateCALENDARIO.onchange= function() { alert('Test'); }

</script>

In this sample I want that always the user change their choices the message "Test" is shown. Today if the user choose for example "July 29, 2013" the event is not fired, but if the user change manually on the "Edit Box" for "July 28, 2013" and click in another place, the event is fired!!!

Could anyone help me? Please?

Thanks!!

1
Side note: || fW == undefined is dead code as !undefined and !null are true (these being the only values which are == undefined). - Fabrício Matté
But I think this is not the problem, because I tried put just document.formWarpRequest or document.getFormWarpRequest too - e.longo
I suggest you use the debugger (F12) and inspect the HTML. You'll probably find that the COgnos edit box is custom HTML that you can't attach certain events to. - Nick.McDermaid
Yeah as I said, it is dead code - it is unreachable and does nothing. I commented because I hate dead code. =] On topic: you'll most likely have to show more code, see SSCCE for guidance. - Fabrício Matté

1 Answers

0
votes

I suggest add jQuery (http://jquery.com) and then you can handle several events easier.

You can see how to do that here:

http://www.ibm.com/developerworks/library/ba-pp-reporting-advanced-report-design-page647/index.html?ca=drs