This discussion is archived
8 Replies Latest reply: Mar 5, 2013 12:05 AM by Hyder Mehtawala RSS

How to disable Search in dropdown control

991337 Newbie
Currently Being Moderated
Hi All,

I am designing a dashboard with a prompt. In this prompt, I am using a dropdown control for which I wish to disable the 'Search...' option.
Does someone know a way to disable the 'Search' option in a dropdown control, so that users cannot search values against the database.

Any kind of help appreciated.

Thanks!

Laurent

Edited by: 988334 on 26 févr. 2013 10:27
  • 1. Re: How to disable Search in dropdown control
    Hyder Mehtawala Expert
    Currently Being Moderated
    Hi Laurent,

    You can try the below workaround to hide the 'Search...' option appearing in the drop down list.

    - Click on Edit Dashboard where the dashboard prompt is present.
    - Add a Text object to the page and paste the below code in it.

    <style>.DropDownSearch{visibility:hidden;}</style>

    - Ensure to check 'Contains HTML markup' option.
    - Save the page and run the dashboard. This should hide the 'Search...' option.

    I tried this on IE and obiee version 11.1.1.6.6.

    Thanks
    Hyder
  • 2. Re: How to disable Search in dropdown control
    991337 Newbie
    Currently Being Moderated
    Hi Hyder,

    It does work. Thank you!

    Laurent
  • 3. Re: How to disable Search in dropdown control
    991337 Newbie
    Currently Being Moderated
    By the way, any idea on how to disable this property for just one particular dropdown among many other dropdowns in one prompt?
    I suppose I have to prefix .DropDownSearch{visibility:hidden;} with the dropdown Id, but which Id is that, as the id="saw_number" does not seem to be persistent.

    Thanks !
    Laurent
  • 4. Re: How to disable Search in dropdown control
    Hyder Mehtawala Expert
    Currently Being Moderated
    To hide the 'Search...' option for only a single dropdown, you can use the below JS script.

    <script type="text/javascript">
    var elems = document.getElementsByTagName("DIV");
    var cnt=0;
    for(i=0;i<elems.length;i++){
    if(elems&#91;i].className == 'DropDownSearch'){
    cnt = cnt + 1;
    if(cnt == 2){
    elems&#91;i].style.visibility = 'hidden';
    }}}
    </script>

    - Add the above script in the Text object and save the dashboard.
    - Ensure to check 'Contains HTML Markup' option.
    - Here, replace the number 2 (near cnt == 2) to the number where the dropdown where Search option is to be removed is placed.
    - For e.g. Say you have 4 dropdown prompts on your dashboard and you want to disable the Search option in the 3rd prompt. So you need to change the if statement to if(cnt == 3).

    Let me know if it works for you.

    Thanks
    Hyder
  • 5. Re: How to disable Search in dropdown control
    991337 Newbie
    Currently Being Moderated
    Not exactly. Here is what I tried :

    <script type="text/javascript">
    var elems = document.getElementsByTagName("DIV");
    var cnt=0;
    for(i=0;i<elems.length;i++){
    alert(elems.className);
    if(elems[i].className == 'DropDownSearch'){
    cnt = cnt + 1;
    if(cnt == 2){
    elems[i].style.visibility = 'hidden';
    }}}
    </script>

    The alert returns many values, but never returns 'DropDownSearch'. So the script never enters the first if statement :(
    I guess that DIV is not the appropriate TagName to be used.

    Any idea welcome. Thank you Hyder !
  • 6. Re: How to disable Search in dropdown control
    Hyder Mehtawala Expert
    Currently Being Moderated
    Try replacing DIV with * i.e. change the below line
    var elems = document.getElementsByTagName("DIV");
    to
    var elems = document.getElementsByTagName("*");

    Let me know if this helps. Also, try without the alert statement as * would return all the tags in the HTML page.

    Thanks
    Hyder
  • 7. Re: How to disable Search in dropdown control
    991337 Newbie
    Currently Being Moderated
    Thanks for your reply. I have tried this, but it does not work.
    Cheers,
    Laurent
  • 8. Re: How to disable Search in dropdown control
    Hyder Mehtawala Expert
    Currently Being Moderated
    Since CSS is able to identify DropDownSearch class not sure why JS code is unable to find it.

    One last thing to confirm. Ensure the static text holding the JS code is placed after the section where your prompts are placed.

    Thanks
    Hyder

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points