最初のオプションが空白 (何も選択されていない) の 2 つの相互排他的 OR cfselect があります。cfselect で空白以外のオプションを選択すると、別の cfselect の空白のオプション (最初のオプション) が javascript 関数で選択されます。ただし、オプションをクリックしても JavaScript 関数は呼び出されません (alert() でテスト済み)。
function resetBusiness() {
alert("resetBusiness() - Entering ..................."");
var aForm = document.forms[0];
var optDiv = aForm.getElementById("sDiv").value;
alert("optDiv: |" + optDiv + "|");
if (optDiv != "") {
aForm.getElementById('sBus').selectedIndex = 0;
aForm.submit();
}
}
function resetDivision() {
alert("resetDivision() - Entering ..................."");
var aForm = document.forms[0];
var optBus = aForm.getElementById("sBus").value;
alert("optBus: |" + optBus + "|");
if (optBus != "") {
aForm.getElementById('sDiv').selectedIndex = 0;
aForm.submit();
}
}
...
<cfselect id="sBus" name="sBus" query="qryBus" display="BU" value="BU"
selected="#HDF(attributes.sBus)#" multiple="yes" size="6"
queryPosition="below"
onClick="javascript:resetDivision(this)">
<option></option>
</cfselect>