Auto populate textboxes from another field value not working when I add another similar script
I have two different combo boxes that are supposed to fill separate text fields. And they both work fine, unless I add both codes at the same time. One of them just stops working.
I don't really know javascript, I followed a tutorial to set them. But I don't know how to make both work. Can someone help me?
These are my two scripts:
var ComboBox1Data =
{ "Example1":{ description: "blah blah",
type: "blah blah",
cost: "blah blah" },
"Example2":{ description: "blah blah",
type: "blah blah",
cost: "blah blah" }};
function SetFieldValues(cComboBox1)
{
this.getField("ExampleDes").value = ComboBox1Data[cComboBox1].description;
this.getField("ExampleType").value = ComboBox1Data[cComboBox1].type;
this.getField("ExampleCost").value = ComboBox1Data[cComboBox1].cost;
}
////
var ComboBox2Data =
{ "Example3":{ name: "blah blah",
part: "blah blah" },
"Example4":{ name: "blah blah",
part: "blah blah" }};
function SetFieldValues(cComboBox2)
{
this.getField("ExampleName").value = ComboBox2Data[cComboBox2].name;
this.getField("ExamplePart").value = ComboBox2Data[cComboBox2].part;
}
