If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Limit user selection in search and select prompt

Started by joms, 30 Jul 2012 06:23:02 AM

Previous topic - Next topic

joms

Hi All,

I am in need of Java code to limit user selection (say about 50) in my search and select  prompt.please anyone respond to it ASAP.
Note:I am using Cognos 10.1 (I tried almost every Google  answers  :))

Thanks,

pricter


joms

Yes pricter,I tried it .But with no success.Can anyonce post a code for Cognos 10 for this requirement.

Cheers,
Joms

joms

Finally got it!!!

Here is the procedure:
tag HTML item with (left of the prompt)
   </div>
    <script>
    //alert('The javascript is running.');
    function CountSelected()
    { 
        var Book_prompt = document.getElementById("selectValues");
        var selectObject =  Book_prompt.getElementsByTagName("SELECT");
        var Book_promptDetails = null;
        var Search1Len = 0;
        var foundSelections = false;
        //second SELECT tag has the selected Choices as
        //OPTIONs. The first SELECT tag has the choices
        //available to choose from (search result). To check
        //whether any values are selected by the user..
        if (selectObject[1] && selectObject[1] != undefined)
        {
            Book_promptDetails = selectObject[1].getElementsByTagName('OPTION');
            Search1Len = Book_promptDetails.length;
            //alert('The number of selections is ' + Search1Len);
            if (Search1Len < 51)                   //Input the value to limit selected items here
            {
                foundSelections = true;
              }
            //alert('The foundSelections value is ' + foundSelections);
        }
            if (foundSelections == true)
        {
         promptAction('finish');
         //clsPromptButtonAction('FINISH');

        }
            else
        {
            alert('The number of selected items is too high, it should be 50 or less, you currently have ' + Search1Len + ' items selected.  Please remove some items then click on Finish again.');
        }
    }   
    //CountSelected();
    </script>

tag HTML item with (right of the prompt):
<div id='selectValues'>

remove finish button and tag HTML item with:

<button type="button" name="finishCheckDate" id="finishCheckDate" style=""
class="clsPromptButton" onmouseover="this.className = 'clsPromptButtonOver'"
onmouseout="this.className = 'clsPromptButton'"
onClick="CountSelected()">FINISH

Enjoy!!!

Cheers.
Joms