I'm creating drop down menus dynamically from a query in coldfusion. There will be from 1 to 10 drop down menus available depending on the data... if there is only data for 2 there will only be 2 shown in the form.
My problem is I'm jusing javascript to calculate product prices depending on what is selected in each drop down. Is there a way I can hide the drop downs that aren't populated with data, or for java to check whether there is data in them or not. Here is what I have -
if (document.product_info.product_option2_value.options[document.product_info.product_option2_value.selectedIndex].value != null) {
option2 = 0;
} else {
option2 = document.product_info.product_option2_value.options[document.product_info.product_option2_value.selectedIndex].value * sq_footage;
}
if (document.product_info.product_option3_value.options[document.product_info.product_option3_value.selectedIndex].value != null) {
option3 = 0;
} else {
option3 = document.product_info.product_option3_value.options[document.product_info.product_option3_value.selectedIndex].value * sq_footage;
}
only thing is that if there isn't a drop down with that name, the fucntion doesn't work at all. I've tried this and tried using the isNaN function.. still nothing
My problem is I'm jusing javascript to calculate product prices depending on what is selected in each drop down. Is there a way I can hide the drop downs that aren't populated with data, or for java to check whether there is data in them or not. Here is what I have -
if (document.product_info.product_option2_value.options[document.product_info.product_option2_value.selectedIndex].value != null) {
option2 = 0;
} else {
option2 = document.product_info.product_option2_value.options[document.product_info.product_option2_value.selectedIndex].value * sq_footage;
}
if (document.product_info.product_option3_value.options[document.product_info.product_option3_value.selectedIndex].value != null) {
option3 = 0;
} else {
option3 = document.product_info.product_option3_value.options[document.product_info.product_option3_value.selectedIndex].value * sq_footage;
}
only thing is that if there isn't a drop down with that name, the fucntion doesn't work at all. I've tried this and tried using the isNaN function.. still nothing