I am trying to do some javascript form validation on the product info page. Basically my product has several lines of customization available for it, as well as font-choices for those lines.
The problem that I am having is trying to get the validation to work with form id's like attrib-5-1. Does anyone know if you can get javascript to work with id's like this?
What I am trying to do is write a validation script similar to this. With the exception that customizationone would be the id attrib-5-1 and the fontone would be attrib-23.
Code:
submit onclick="return checkCustomization(this.form)"
function checkCustomization(order_form) {
var error = "";
if (document.forms.order_form.customizationone.value != "") {
//check if they selected the font for this customization
if (document.forms.order_form.fontone.value == "") {
why = "You did not choose a font for Customization Line 1";
}
}
if (why != "") {
alert(why);
return false;
}else{
return true;
}
}
Bookmarks