COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Ricky@MDPD on 21 Aug 2008 10:25:41 AM

Title: Defaulting date prompt to BLANK
Post by: Ricky@MDPD on 21 Aug 2008 10:25:41 AM
I'm trying to modify the following script (taken from cognos website) to use in defaulting a date prompt to blank:
-------------------------------------------------------------------------
<script language="javascript">
document.forms["formWarpRequest"].elements["txtDateNAMEOFOBJECT"].value='TXT';
</script>
<body oNLoad=init()>
<form name="formWarpRequest">
------------------------------------------------------------------------
What do I use for the NAMEOFOBJECT? how do I find the name that cognos gives to the date field prompt?


Is there any other scripts I can use?

Thanks
Title: Re: Defaulting date prompt to BLANK
Post by: masilabalu on 08 Jan 2009 11:52:03 PM
Quote from: Ricky@MDPD on 21 Aug 2008 10:25:41 AM
I'm trying to modify the following script (taken from cognos website) to use in defaulting a date prompt to blank:
-------------------------------------------------------------------------
<script language="javascript">
document.forms["formWarpRequest"].elements["txtDateNAMEOFOBJECT"].value='TXT';
</script>
<body oNLoad=init()>
<form name="formWarpRequest">
------------------------------------------------------------------------
What do I use for the NAMEOFOBJECT? how do I find the name that cognos gives to the date field prompt?


Is there any other scripts I can use?

Thanks

Hi Ricky,

I am using your code only it is working....

In the Date Prompt Properties at last property "Name" column is there you enter the name(Unique name) then use this name...

But i dont know how to pass value from JavaScript to query item.....


thanks
Balu
Title: Re: Defaulting date prompt to BLANK
Post by: Sunchaser on 09 Jan 2009 04:07:31 AM
Hi


What do I use for the NAMEOFOBJECT? how do I find the name that cognos gives to the date field prompt?


If you are on 8.3, you're going to have problems because the "Id" of objects are not fixed (they are concatenated with "variables").
This code should work in 8.2 but not in 8.3.

In 8.3, you'll have to put tags like "<DIV id="My_ID">" before the prompt object and "</DIV> after, in order to catch this DIV by javascript, and then do a "getElementByTagName" on this DIV in order ot catch the prompt object "inside".
(be carefull, because there are hidden objects generated with Cognos Prompt objects, so the index of the object in the "array" given by "getElementByTagName" is not always 0 or something like that).