From the codes below, I'm trying to pass the arrayname to the function:
if "value1" is selected, then arrvalue1cfgn and arrvalue1cfgv is passed through to the selectChange function:
\"arr\" + this.value + \"cfgn\" = arrvalue1cfgn
\"arr\" + this.value + \"cfgv\" = arrvalue1cfgv
However, this doesn't seem to work, what is the correct way to pass the array name based on the form value selected?
Thanks!
<SCRIPT LANGUAGE="JavaScript">
var arrvalue1cfgv = new Array("prod1v_val1","prod1v_val2","prod1v_val3");
var arrIvalue1cfgn = new Array("prod1n_val1","prod1n_val2","prod1n_val3");
function selectChange(control, controlToPopulate, ItemArray, ValueArray )
{
var myEle ;
var x ;
for ( x = 0 ; x < ItemArray.length ; x++ )
{
myEle = document.createElement("option") ;
myEle.value = ValueArray[x] ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}
</SCRIPT>
<SELECT id=product name=product onchange="selectChange(this,Form.Application, \"arr\" + this.value + \"cfgn\", \"arr\" + this.value + \"cfgv\");">
<option value="value1" selected>name1</option>
<option value="value2">name2</option>
</select>
if "value1" is selected, then arrvalue1cfgn and arrvalue1cfgv is passed through to the selectChange function:
\"arr\" + this.value + \"cfgn\" = arrvalue1cfgn
\"arr\" + this.value + \"cfgv\" = arrvalue1cfgv
However, this doesn't seem to work, what is the correct way to pass the array name based on the form value selected?
Thanks!
<SCRIPT LANGUAGE="JavaScript">
var arrvalue1cfgv = new Array("prod1v_val1","prod1v_val2","prod1v_val3");
var arrIvalue1cfgn = new Array("prod1n_val1","prod1n_val2","prod1n_val3");
function selectChange(control, controlToPopulate, ItemArray, ValueArray )
{
var myEle ;
var x ;
for ( x = 0 ; x < ItemArray.length ; x++ )
{
myEle = document.createElement("option") ;
myEle.value = ValueArray[x] ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}
</SCRIPT>
<SELECT id=product name=product onchange="selectChange(this,Form.Application, \"arr\" + this.value + \"cfgn\", \"arr\" + this.value + \"cfgv\");">
<option value="value1" selected>name1</option>
<option value="value2">name2</option>
</select>