Hi, I have a combobox and a hidden field. When combobox value is changed, I am storing the text value of combobox in the hidden field, below are those to fields
Code:
<input type="hidden" name="strPrinterName"/>
<select name="cboPrinterName" onClick="fnSetPrinterName()">
<%=objLoadCombo.loadAvailablePrintersCombo()%>
</select>
This combo boxes option values are generated by a bean.
OnClick() event of the combobox i have called a javascrpt function fnSetPrinterName(), Below is the function implementaion,
Code:
var frmName = document.forms[0];
function fnSetPrinterName(){
gfnCopyCBTextToOtherElt(frmName.cboPrinterName,frmName.strPrinterName);
}
The function internally calles another function gfnCopyCBTextToOtherElt(), that takes combobox and hidden field through the parameter, Below is the function implementaion.
Code:
function gfnCopyCBTextToOtherElt(strCBName,strOtherElt){
var strList = frmName.elements[strCBName.name];
if(strList.selectedIndex!=null)
frmName.elements[strOtherElt.name].value
= strList.options[strList.selectedIndex].text;
}
The above function worked well for other sets of combobox-hidden field combinations. But This one case its giving error in function gfnCopyCBTextToOtherElt(strCBName,strOtherElt),
The line of code where the error occured is
Code:
frmName.elements[strOtherElt.name].value = strList.options[strList.selectedIndex].text;
The error is "Object does not support this property or method."
Ajit