Blake
Premium
- 10,976

- NSW, Australia
- haswell00
I’m having trouble how to figure out how to work with the <select> and <option> tags.
I am using the following function for various errors in a form.
Anyway, part of the form has some drop down boxes, and if certain conditions are met I use my error function.
My problem is that I need to pass something to f in my error function. I’m not sure what to pass to it from a <select> tag…
The part in bold and red is what I’m having trouble with. I hope I made myself clear. thanks. 👍
I am using the following function for various errors in a form.
Code:
function error(f, message) {
alert(message);
f.select();
}
Anyway, part of the form has some drop down boxes, and if certain conditions are met I use my error function.
My problem is that I need to pass something to f in my error function. I’m not sure what to pass to it from a <select> tag…
The part in bold and red is what I’m having trouble with. I hope I made myself clear. thanks. 👍
Code:
if(f.delDays.options.selectedIndex == today) {
error([COLOR="DarkRed"][B]f.delDays[/B][/COLOR], 'We require 1 day notice on deliveries. Please select another day.');
return false;
}
else {
if(f.delTime.options.selectedIndex < 4 || f.delTime.options.selectedIndex > 24) {
error([COLOR="DarkRed"][B]f.delTime[/B][/COLOR], 'We can\u2019t deliver before 10am or after 3pm.');
return false;
}
}