Forum Moderators: open
This checks for null and empty:
function isFilled(elm) {
if (elm.value == "" ¦¦
elm.value == null)
return false;
else return true;
}
This checks for the yes/no radio:
var open;
for (var i=0; i<form.Business_open.length; i++) {
if (form.Business_open[i].checked) {
open = 1;
break;
}
}
if (open!= 1) {
alert("Please tell us if your business is open now.");
return false;
}
And this makes the pulldown select required, no matter what. I want it to be conditional on the above radio option being the "no" value; that is, if "no" then select is required:
if(form.When_are_you_opening.options[form.When_are_you_opening.selectedIndex].value == "Select") {
alert("Please tell us when your business is opening.")
form.When_are_you_opening.focus();
return false;
}
Thanks for any help!
Tim
var open;
for (var i=0; i<form.Business_open.length; i++) {
if (form.Business_open[i].checked) {
open = 1;
var radioVal = form.Business_open[i].value;
break;
}
}
radioVal can now be either 'no' or 'yes', presuming these are the values you gave the input elements.