Set Field Value onChange

Good Day,

I have a field that is dependent on a prior fields value.

Field one is Business Unit and Field two is Location.

I have several Business Units that have a single Location and I am trying to set the field values for those locations as follows;

if BU = X then Location = Toronto, if BU = Y then Location = Montreal else Location = “”

var f = document.forms[0];

if (f.BU.value == “TSX”)

{

f.Location.value = "Toronto"

}

This is coded into the onChange as Common JS but it does not do anything…

Have the holidays broken my brain, am I missing something basic here??

HELP>>>>>

please… :slight_smile:

Ken

Subject: Set Field Value onChange

If your Business Unit is a Combo box or a Dialog list then f.BU.value will not work.

Instead use -

var f = document.forms[0];

if(f.BU[f.BU.selectedIndex].value ==“TSX”)

{

f.Location.value = "Toronto"

}

.value method only works for text fields and text areas.

–Phani

Subject: RE: Set Field Value onChange

I have tried this and it doesn’t work for me at all…

I have tried using

var BU = document.forms[0].BU;

for (i=0;i<document.forms[0].BU.length;i++)

{

 if (document.forms[0].BU[i].checked) 

	{

	user_input = document.forms[0].BU[i].value;

	questionoption = i;

	}

}

alert (user_input)

This doesn’t work in IE… companys only web browser and works fine in FF…

Any other suggestions??