Quick problem here:
I have a form containing zero to five drop-down label selections (option_a, option_b, etc...) depending upon what's pulled from my SQL database. So in short, sometimes the page contains 1, 2 or more of these labels... other times it contains none at all.
I want to validate the info in those dropdowns, but first I need to see if each option exists.
First I tried this code:
Expand|Select|Wrap|Line Numbers
- var valid = 1;
- var errmsg = "";
- var errmsg1 = "Please make sure all drop-down selections are made.";
- var frm = document.addtocartform;
- if (frm.option_a.value != undefined) {
- if (frm.option_a.value == "Please Select") {
- errmsg = errmsg1;
- valid = 0;
- }
- }
I tried using TYPEOF, but that doesn't seem to work either. Substitute the above 'if' statement with the following code:
Expand|Select|Wrap|Line Numbers
- if (typeof frm.option_a.value != 'undefined') {
Thanks in advance.