I have three select boxes:
<select id="one">
<option value="default">Select Product</option>
<option value="value-a1">string1</option>
<option value="value-a2">string2</option>
<option value="value-a3">string3</option>
</select>
<select id="two">
<option value="default">Select Version</option>
<option value="value-b4">string4</option>
<option value="value-b5">string5</option>
<option value="value-b6">string6</option>
</select>
<select id="three">
<option value="default">Select Architecture</option>
<option value="value-c6">string7</option>
<option value="value-c7">string8</option>
<option value="value-c8">string9</option>
</select>
Based on what the user selects for these three boxes, I want to download a file like so, for example:
mysite.com/download/value-a1_value-b2_value-c3
Basically, the file is an installer, that can be a certain product, a specific version, and the architecture (using EXE as an example; will have DMG and ZIP too):
mysite.com/download/product-a_version-b_arch-64.exe
I understand that my approach may not be the best, so I’m open to suggestions, but if I could get this approach to work, that would be great.
For the JavaScript I was thinking something like this:
function download_file(version_id, os_id, arch_id) {
if (product_id == 'default' && version_id == 'default' &&
arch_id == 'default') {
return;
}
else if (product_id != 'default') {
window.location = 'mysite.com/download/Install_' +
product_id + '_' + version_id + '_' + arch_id + '.exe';
}
}
I guess my main problem is how to select what select values are chosen in the three select boxes. I’m trying to glue together the results from the three select boxes and determine a path from that.
NOTE
I actually had more select boxes than I actually wrote about, but the principles are the same. Using answers below, I was able to get the file to be correct. Thanks for all the help!
jsFiddle Demo