I have the following code which is working absolutely great in having two ListBoxes; A simple listing on the left and a select search on the right. Nimrod has been a great help in coming up with this solution but now I just need to add the code that will disable/hide
the
Deselect Tag from the left Box called RBPrompt. So, when a value is selected from the left ListBox, the right Deselect link under the Select Search needs
to be disabled/hidden.
Here is small part of the overall code that I am trying to insert the code,
Quotefunction disableEnablePr(fl,dir){
if(fl==1){//selected prompt is SNS, need to disable RB
if(checkIfPromptHasValue(2)){//something is selected in RB Prompt
for(var i=0;i<RBPrompt.length;i++){
if(RBPrompt.selected){
RBPrompt.selected=dir?false:true;
break;
}
}
}
RBPrompt.disabled=dir;
}
else{//RB Prompt is selected, SnS needs to be disabled
if(dir){select :)List.selectedIndex=-1;}//unselect
document.getElementById("snsPr").children[0].disabled=dir;
document.getElementById("snsPr").getElementsByTagName("input")[1].disabled=dir;
document.getElementById("snsPr").getElementsByTagName("button")[0].disabled=dir;
}
}
function main(fl){
//check if a value is selected in the prompt
if(checkIfPromptHasValue(fl)){
//disable the other prompt
disableEnablePr(fl,true);
}
else{
disableEnablePr(fl,false);
}
}
I did some search and identified the following as the code for hiding the Deselect but for some reason, it is not hiding the Deselect from the left Box.
When an item is selected from the left ListBox (a simple List), the Right box (A Search and Select ListBox), Deselect All is Gray-out or hiding without any problem.
I think I suppose to use the code that utilizes the following tag but haven't found a way to get it in to this code, [PRMT_SV_LINK_DESELECT]').hide()
Please help if your time allows and thank you in advance for your time.
Well,
the following won't even disable or hide the Deselect.
<script type="text/javascript">
// hiding select All/deselect All in Cognos 8.3 form.
Quotefor(j=0;j<document.links.length;j++)
{
y=document.links[j];
if (y.id.indexOf("SELECT") != -1) document.getElementById(y.RBPrompt).style.display='None';
}
</script>
probably because of 8.3 and not 10.1.2
OK,
The following get rid of the Deselect or Select tags and it worked. Now I have to figure out how to include it the JScript. ::) Getting closer!!!!
Quote<script>
var a = document.getElementsByTagName("A");
for( var i = a.length-1; i >= 0; i-- )
{
var link = a;
if( typeof(link.id) == "string" && link.id.match(/PRMT_(SV|LIST)_LINK_(DE)?SELECT_/) )
{
link.parentNode.removeChild(link);
}
}
</script>
Well, I included in the original code and it disables all the Deselects from both Left (List Box) and Right (Search and Select Boxes).
The code is doing great for disabling the Deseelct Link when the Left List is selected. The problem is when a value is selected from the Search and Select Box on the right, the Deselect Link is not disabled (Grayed-Out).
Please help!! :(
My apologies for bothering this forum for this issue but I think the Deselect link is actually getting disabled;however, the color
is not changing to gray. It seems like the RBPrompt.disabled=dir; is doing it's job by disabling the RBPrompt.
I guess I'll look for a command to change the color of a link.
:) :) :)
:o
Added another TAG,
var searchList=document.getElementById("RBPrompt").getElementsByTagName("select")[0];
and treated the same way Nimrod had it.
Thx guys.