I am trying to populate dropdown(s) on select of an option in 1st dropdown(product), using pure java script. But got struck at mapping respective files to product, especially when the same version number repeats for different products
following is the data set.
productA => version1.0.0 => FileA1.zip
productA => version1.0.1 => FileA2.zip
productB => version3.5.0 => FileB1.zip
productB => version4.0.1 => FileB2.zip
productC => version1.0.0 => FileC1.zip
productC => version1.0.1 => FileC2.zip
My javascript arrays
var ProductNameMap = {
"ProductA":["1.0.0","1.0.1"],
"ProductB":["3.5.0","4.0.1"],
"ProductC":["1.0.0","1.0.1"],
};
//want to map files specifically associated with particular product
var ProductSeriesMap = {
"version1.0.0":["FileA1.zip"],
"version1.0.1":["FileA2.zip"]
};
How can I differentiate between ProductA => version1.0.0 and ProductC => version1.0.0 during this mapping ?
My html
<html>
<body>
Product:
<select id="product" onchange="changeproduct">
<option>--Choose Product--</option>
</select><br/>
Version:<select id="version" onchange="changeversion" ></select><br/>
File:<select id="file"></select>
<script>
//have my java script here to populate dropdowns
</script>