Topic
  • 4 replies
  • Latest Post - ‏2013-06-18T23:09:45Z by OpherB
Suresh_Regmi
Suresh_Regmi
26 Posts

Pinned topic Default Selection of Select and Search Prompt Using JS

‏2009-02-25T15:14:10Z |
Hi All,
The following code was fine for 8.2 to change the default selection under 'options' in a select and search prompt.

<script langauge='JavaScript'>
// Contains any of these keywords
document.forms("formWarpRequest")._sws_Acc_Prompt_matchAnywhere.value = 'true';
document.forms("formWarpRequest")._sws_Acc_Prompt_matchAll.value = 'false';
document.forms("formWarpRequest").swsOptionAcc_Prompt(2).checked=true;
</script>

Now we're in 8.3 and this code is not working any more; Has anyone used it with updated version please?

Thanks in advance.
Updated on 2012-09-10T12:25:00Z at 2012-09-10T12:25:00Z by DanielWagemann
  • MChandrasekhara
    MChandrasekhara
    9 Posts

    Re: Default Selection of Select and Search Prompt Using JS

    ‏2012-09-10T08:00:28Z  
    Hi ,

    I have tried the above javascript, But not working in Cognos 10.1 V..

    Can anyone help out on this requirement “Cognos Select search prompt with default option as “Contains any of these keywords” .
    How can I achieve…

    Thanks for an advance
  • DanielWagemann
    DanielWagemann
    411 Posts

    Re: Default Selection of Select and Search Prompt Using JS

    ‏2012-09-10T12:25:00Z  
    Hi ,

    I have tried the above javascript, But not working in Cognos 10.1 V..

    Can anyone help out on this requirement “Cognos Select search prompt with default option as “Contains any of these keywords” .
    How can I achieve…

    Thanks for an advance
    Report spec taken from http://www-01.ibm.com/support/docview.wss?uid=swg21343293 work like a charm in both 8 and 10.1.1.
  • nycognosdev
    nycognosdev
    1 Post

    Re: Default Selection of Select and Search Prompt Using JS

    ‏2013-06-18T20:42:12Z  
    Report spec taken from http://www-01.ibm.com/support/docview.wss?uid=swg21343293 work like a charm in both 8 and 10.1.1.

    hi,  following is the javascript i got from the attachment. please confirm is this is correct or not because its not working in our reports. i apologize in advance if i didn't copy correctly. please send me the Script again. Thanks in advance.

    Also NOTE that we are using Cognos 10.2 so please let me know if this would work in 10.2 or not.

     

    <script type="text/javascript">

    function setSaSoptions()
    {
    var optNo = 3;
    // 1 = Starts with any ... (default)
    // 2 = Starts with first ...
    // 3 = Contains any ...
    // 4 = Contains all ...
        
    var optCnt = 0;
        var mySpan = document.getElementById("mySpan1");
        
    var myInput = mySpan.getElementsByTagName("input");

    for(i=0;i&lt;myInput.length;i++){
    if(myInput[i].type=="text")
    {
    if(myInput[i].value&gt;'')
    {
    return;}}
            
    if(myInput[i].type=="radio") optCnt++;
            
    if(optCnt==optNo) myInput[i].click();
        }
    }
    setTimeout("setSaSoptions();", 100);
    </script>

  • OpherB
    OpherB
    664 Posts

    Re: Default Selection of Select and Search Prompt Using JS

    ‏2013-06-18T23:09:45Z  

    I would suggest reading the documentation for how to upgrade Javascript to Cognos 8.3 (and later):
     

    http://public.dhe.ibm.com/software/dw/dm/cognos/upgrade_and_migration/bi/upgrading_javascript_applications.pdf

     

    Good luck,
    Opher