Hello Smart people of the world!
I have a simple web form with a seperate javascript validation that validates all fields to be filled in. I have one exception though that is if the user select this radio buttion I want it to skip over 4 of the fields that are supposed to be validated.
Something like IF user select *member, then don't validate the credit section (4 fields) the radio button's name is called 'Member'
Any quick fixes would be awesome!
THANKS!
--see the code below
var errorMsg;
function validate(theform) {
var errorOccurred = false;
errorMsg = "";
if (!theform.Last_name.value) {
errorMsg += "<li>Your last name<" + "/li>";
errorOccurred = true;
}
if (!theform.First_name.value) {
errorMsg += "<li>Your first name<" + "/li>";
errorOccurred = true;
}
if (!theform.Faculty.value) {
errorMsg += "<li>Your faculty studied in<" + "/li>";
errorOccurred = true;
}
if (!theform.Gr_year.value) {
errorMsg += "<li>Your year of graduation<" + "/li>";
errorOccurred = true;
}
if (!theform.Years_at_address1.value) {
errorMsg += "<li>Years living at home address<" + "/li>";
errorOccurred = true;
}
if (!theform.Address1.value) {
errorMsg += "<li>Your street address<" + "/li>";
errorOccurred = true;
}
if (!theform.City.value) {
errorMsg += "<li>Your city<" + "/li>";
errorOccurred = true;
}
if (!theform.Province.value) {
errorMsg += "<li>Your province/state (if applicable)<" + "/li>";
}
if (!theform.Postal_Code.value) {
errorMsg += "<li>Your postal or ZIP code (if applicable)<" + "/li>";
}
if (!theform.Country.value) {
errorMsg += "<li>Your country<" + "/li>";
errorOccurred = true;
}
if (!theform.Home_phone.value) {
errorMsg += "<li>Your home phone number<" + "/li>";
errorOccurred = true;
}
if (!theform.Email.value) {
errorMsg += "<li>Your preferred email address<" + "/li>";
errorOccurred = true;
}
if (!theform.Gift_amount.value) {
errorMsg += "<li>Your gift amount<" + "/li>";
errorOccurred = true;
}
if (!theform.Currency.value) {
errorMsg += "<li>Type of currency<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_holdername.value) {
errorMsg += "<li>Card holder's name<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_type.value) {
errorMsg += "<li>Card type<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_number.value) {
errorMsg += "<li>Card number<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_month.value) {
errorMsg += "<li>Card month expiration<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_year.value) {
errorMsg += "<li>Card year expiration<" + "/li>";
errorOccurred = true;
}
if (errorOccurred) {
errorWindow = window.open("formerror.shtm", "errWin", "width=400,height=275,resizable=yes,scrollbars=yes");
errorWindow.focus();
return false;
}
else return true;
}
I have a simple web form with a seperate javascript validation that validates all fields to be filled in. I have one exception though that is if the user select this radio buttion I want it to skip over 4 of the fields that are supposed to be validated.
Something like IF user select *member, then don't validate the credit section (4 fields) the radio button's name is called 'Member'
Any quick fixes would be awesome!
THANKS!
--see the code below
var errorMsg;
function validate(theform) {
var errorOccurred = false;
errorMsg = "";
if (!theform.Last_name.value) {
errorMsg += "<li>Your last name<" + "/li>";
errorOccurred = true;
}
if (!theform.First_name.value) {
errorMsg += "<li>Your first name<" + "/li>";
errorOccurred = true;
}
if (!theform.Faculty.value) {
errorMsg += "<li>Your faculty studied in<" + "/li>";
errorOccurred = true;
}
if (!theform.Gr_year.value) {
errorMsg += "<li>Your year of graduation<" + "/li>";
errorOccurred = true;
}
if (!theform.Years_at_address1.value) {
errorMsg += "<li>Years living at home address<" + "/li>";
errorOccurred = true;
}
if (!theform.Address1.value) {
errorMsg += "<li>Your street address<" + "/li>";
errorOccurred = true;
}
if (!theform.City.value) {
errorMsg += "<li>Your city<" + "/li>";
errorOccurred = true;
}
if (!theform.Province.value) {
errorMsg += "<li>Your province/state (if applicable)<" + "/li>";
}
if (!theform.Postal_Code.value) {
errorMsg += "<li>Your postal or ZIP code (if applicable)<" + "/li>";
}
if (!theform.Country.value) {
errorMsg += "<li>Your country<" + "/li>";
errorOccurred = true;
}
if (!theform.Home_phone.value) {
errorMsg += "<li>Your home phone number<" + "/li>";
errorOccurred = true;
}
if (!theform.Email.value) {
errorMsg += "<li>Your preferred email address<" + "/li>";
errorOccurred = true;
}
if (!theform.Gift_amount.value) {
errorMsg += "<li>Your gift amount<" + "/li>";
errorOccurred = true;
}
if (!theform.Currency.value) {
errorMsg += "<li>Type of currency<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_holdername.value) {
errorMsg += "<li>Card holder's name<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_type.value) {
errorMsg += "<li>Card type<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_number.value) {
errorMsg += "<li>Card number<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_month.value) {
errorMsg += "<li>Card month expiration<" + "/li>";
errorOccurred = true;
}
if (!theform.Card_year.value) {
errorMsg += "<li>Card year expiration<" + "/li>";
errorOccurred = true;
}
if (errorOccurred) {
errorWindow = window.open("formerror.shtm", "errWin", "width=400,height=275,resizable=yes,scrollbars=yes");
errorWindow.focus();
return false;
}
else return true;
}