I have a reference example that uses a dropdown that chains to two other dropdowns.
Basically I have two chains.
Dropdown1 to Dropdown2
Dropdown1(Hidden Copy) to Dropdown3
When a selection is made on Dropdown1 its selectedIndex and value are copied to Dropdown1 (Hidden Copy) and then the onChange event for Dropdown1(Hidden Copy) is fired.
I did not write the Javascript so I take no credit for it.
Hope this helps and gives you some ideas.
Note: This was developed in WF 5.33 it may not work in 7.6X because HTML Layout Painter uses XML and is very different from Resource Layout Painter.
Here is the HTML file.
split_chaining_example.htm
<HTML>
<HEAD>
<TITLE>Split Chaining Example
</TITLE>
<SCRIPT type=text/javascript>
//Used to simulate a onChange event for the hidden dropdown so that chaining will occur
function fireEvent(element,event)
{
if (document.createEventObject){
// dispatch for IE
var evt = document.createEventObject();
return element.fireEvent('on'+event,evt)
}
else{
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true ); // event type,bubbling,cancelable
return !element.dispatchEvent(evt);
}
}
//Will set the selected index in the hidden to the same value has the first dropdown
function changeValues(elementFrom, elementTo)
{
var selectObject = document.getElementById(elementFrom);
var selectIndex = selectObject.selectedIndex;
var selectValue = selectObject.options[selectIndex].value;
var selectText = selectObject.options[selectIndex].text;
var selectObjectTo = document.getElementById(elementTo);
selectObjectTo.options[selectIndex].selected = true;
fireEvent(selectObjectTo, 'change');
}
</SCRIPT>
<META content="WebFocus Report Layout Painter" name ="Generator">
<SCRIPT id=IbiOptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls";
var multidrill = "multidrill";
var mntFormValidate = "mntFormValidate";
var dyncalendar = "dyncalendar";
var ibiOptions = new Array(cgipath,ibirls,mntFormValidate,multidrill);
</SCRIPT>
<SCRIPT id=nls src="/ibi_html/javaassist/nls.js" type=text/javascript>
</SCRIPT>
<SCRIPT id=ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript>
</SCRIPT>
<SCRIPT id=ibigblloadCss type=text/javascript>
ibigblloadCss(null);
</SCRIPT>
</HEAD>
<BODY onload=OnLoad() nextelementnum="1" drawgrid="1" snaptogrid="1" gridsizeCX="10" gridsizeCY="10" pagesizeCX="2000" pagesizeCY="2000">
<!-- Actual code for the two dropdowns associated with id=ITEM1 and id=ITEM4
The WebFOCUS GUI removes this custom HTML code.
<SELECT id=ITEM1 onChange="changeValues('ITEM1', 'ITEM4');" style="FONT-WEIGHT: 400; FONT-SIZE: 12pt; Z-INDEX: 4; LEFT: 120px; WIDTH: 150px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 190px; HEIGHT: 22px; TEXT-DECORATION: none" name ="COUNTRY" elementname="COUNTRY" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="0" dynalldisplayvalue="ALL" inchainindex="1" chainnumber="0" cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeMaster" datasource="CAR.mas" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM4 style="DISPLAY:none; FONT-WEIGHT: 400; FONT-SIZE: 12pt; Z-INDEX: 4; LEFT: 440px; WIDTH: 150px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 190px; HEIGHT: 22px; TEXT-DECORATION: none" name ="COUNTRY" elementname="COUNTRY" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="0" dynalldisplayvalue="ALL" inchainindex="1" chainnumber="1" cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeMaster" datasource="CAR.mas" datafieldtype="CHAR">
</SELECT>
-->
<!--startibiitems-->
<FORM onsubmit=SaveValues() method=post name ="form">
<INPUT type=hidden value=split_chaining_example name ="IBIF_ex">
<INPUT id=IBIAPP_app type=hidden value=testing name ="IBIAPP_app">
<SELECT id=ITEM1 onChange="changeValues('ITEM1', 'ITEM4');" style="FONT-WEIGHT: 400; FONT-SIZE: 12pt; Z-INDEX: 4; LEFT: 120px; WIDTH: 150px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 190px; HEIGHT: 22px; TEXT-DECORATION: none" name ="COUNTRY" elementname="COUNTRY" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="0" dynalldisplayvalue="ALL" inchainindex="1" chainnumber="0" cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeMaster" datasource="CAR.mas" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM4 style="DISPLAY:none; FONT-WEIGHT: 400; FONT-SIZE: 12pt; Z-INDEX: 4; LEFT: 440px; WIDTH: 150px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 190px; HEIGHT: 22px; TEXT-DECORATION: none" name ="COUNTRY" elementname="COUNTRY" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="0" dynalldisplayvalue="ALL" inchainindex="1" chainnumber="1" cacheruntimedata="0" displayfield="COUNTRY" numofrecords="-1" datafield="COUNTRY" sourcetype="typeMaster" datasource="CAR.mas" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM2 style="FONT-WEIGHT: 400; FONT-SIZE: 12pt; Z-INDEX: 5; LEFT: 120px; WIDTH: 210px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 300px; HEIGHT: 22px; TEXT-DECORATION: none" name ="CAR" elementname="CAR" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="0" dynalldisplayvalue="ALL" inchainindex="2" chainnumber="0" cacheruntimedata="0" displayfield="CAR" numofrecords="-1" datafield="CAR" sourcetype="typeMaster" datasource="CAR.mas" datafieldtype="CHAR">
</SELECT>
<SELECT id=ITEM3 style="FONT-WEIGHT: 400; FONT-SIZE: 12pt; Z-INDEX: 6; LEFT: 440px; WIDTH: 260px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 300px; HEIGHT: 22px; TEXT-DECORATION: none" name ="MODEL" elementname="MODEL" elementtype="combobox" labelid caption="combobox" operation="NONE" ibiformat datatype="1" addalloption="0" dynalldisplayvalue="ALL" inchainindex="2" chainnumber="1" cacheruntimedata="0" displayfield="MODEL" numofrecords="-1" datafield="MODEL" sourcetype="typeMaster" datasource="CAR.mas" datafieldtype="CHAR">
</SELECT>
<INPUT id=ITEM6 style="FONT-WEIGHT: 700; FONT-SIZE: 12pt; Z-INDEX: 7; LEFT: 120px; WIDTH: 100px; BORDER-TOP-STYLE: groove; FONT-STYLE: normal; FONT-FAMILY: Arial; BORDER-RIGHT-STYLE: groove; BORDER-LEFT-STYLE: groove; POSITION: absolute; TOP: 350px; HEIGHT: 40px; TEXT-DECORATION: none; BORDER-BOTTOM-STYLE: groove" onclick=OnRunRemoteObject() type=button value="Run Report" name ="button" elementname="button" elementtype="button" sourcetype="typeFex" IBIC_server="EDASERVE" IBIAPP_app="testing" targetname="_blank" targettype="1" onclicksource="split_chaining_example.fex" onclickset="1" variables="COUNTRY;CAR;MODEL">
<SPAN id=ITEM7 style="FONT-WEIGHT: 700; FONT-SIZE: 12pt; Z-INDEX: 11; LEFT: 120px; WIDTH: 120px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 170px; HEIGHT: 20px; TEXT-DECORATION: none" name ="text7" elementname="text7" elementtype="text">
<SPAN sourcetype="typeUrl" targettype="0" FragmentColor="0" FragmentStartChar="0" FragmentEndChar="7">COUNTRY
</SPAN>
</SPAN>
<SPAN id=ITEM8 style="BORDER-TOP-WIDTH: 0px; FONT-WEIGHT: 700; BORDER-LEFT-WIDTH: 0px; FONT-SIZE: 12pt; Z-INDEX: 12; LEFT: 120px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 120px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 280px; HEIGHT: 20px; BORDER-RIGHT-WIDTH: 0px; TEXT-DECORATION: none" name ="text9" elementname="text9" elementtype="text">
<SPAN sourcetype="typeUrl" targettype="0" FragmentColor="0" FragmentStartChar="0" FragmentEndChar="3">CAR
</SPAN>
</SPAN>
<SPAN id=ITEM9 style="BORDER-TOP-WIDTH: 0px; FONT-WEIGHT: 700; BORDER-LEFT-WIDTH: 0px; FONT-SIZE: 12pt; Z-INDEX: 13; LEFT: 440px; BORDER-BOTTOM-WIDTH: 0px; WIDTH: 120px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 280px; HEIGHT: 20px; BORDER-RIGHT-WIDTH: 0px; TEXT-DECORATION: none" name ="text10" elementname="text10" elementtype="text">
<SPAN sourcetype="typeUrl" targettype="0" FragmentColor="0" FragmentStartChar="0" FragmentEndChar="5">MODEL
</SPAN>
</SPAN>
<SPAN id=ITEM10 style="FONT-WEIGHT: 700; FONT-SIZE: 18pt; Z-INDEX: 18; LEFT: 120px; WIDTH: 500px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 60px; HEIGHT: 40px; TEXT-ALIGN: center; TEXT-DECORATION: none" name ="text10" elementname="text10" elementtype="text">
<SPAN sourcetype="typeUrl" targettype="0" FragmentColor="0" FragmentStartChar="0" FragmentEndChar="22">Split Chaining Example
</SPAN>
</SPAN>
<SPAN id=ITEM11 style="FONT-WEIGHT: 400; FONT-SIZE: 12pt; Z-INDEX: 19; LEFT: 120px; WIDTH: 790px; FONT-STYLE: normal; FONT-FAMILY: Arial; POSITION: absolute; TOP: 460px; HEIGHT: 120px; TEXT-DECORATION: none" name ="text11" elementname="text11" elementtype="text">
<SPAN sourcetype="typeUrl" targettype="0" FragmentColor="0" FragmentStartChar="0" FragmentEndChar="241">Uses Javascript
<BR>A) to copy the selected value in COUNTRY dropdown to the hidden COUNTRY dropdown
<BR>B) simulate a change event in the hidden COUNTRY dropdown so that chaining will occur
<BR>C) [style: DISPLAY:none] is used to hide the dropdown
</SPAN>
</SPAN>
</FORM>
<SCRIPT type=text/javascript>
<!--
window.chain0=new Array(1);
window.chain0[0]=new String("ITEM1;ITEM2");
window.chain0[1]=0
window.chain1=new Array(1);
window.chain1[0]=new String("ITEM4;ITEM3");
window.chain1[1]=0
//-->
</SCRIPT>
<!--endibiitems-->
<SCRIPT id=OnloadHandler>
function OnLoad()
{
<!--startibilines-->
UpdateData();
<!--endibilines-->
}
</SCRIPT>
</BODY>
</HTML>
Here is the fex file
split_chaining_example.fex
-* Main fex file
-DEFAULT &COUNTRY= 'FOC_NONE', &CAR= 'FOC_NONE', &MODEL= 'FOC_NONE'
TABLE FILE CAR
PRINT
DEALER_COST
RETAIL_COST
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ '&COUNTRY';
WHERE CAR EQ '&CAR';
WHERE MODEL EQ '&MODEL';
END
-*HTMLFORM split_chaining_example
WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files