Thought I would share my validation with you guys here. Took me a while to figure out. If anyone wants to modify/improve it, please feel free. Just want to help anyone else who needs it. Foxycart is sooooo open/flexible.
<script language="javascript">
// are these needed?
var size = "";
var color = "";
//run this from the jquery function below
function fc_PreProcess(color, size) {
//clear error_string
var error_string = "";
if (color == "") { error_string = error_string + "You must select a color.\n"; }
if (size == "") { error_string = error_string + "You must select a size.\n"; }
if (size == "" || color == "") {
alert(error_string);
return false;
} else {
return true;
}
}
$j(function() {
//run validation on forms with submit (if some products dont need this validation, you can give them a different class name)
$j('.submit').bind('click', function() {
//first drop-down item
var size = $j(this).parents("form:first").find("select:eq(0)").val();
//second drop down item
var color = $j(this).parents("form:first").find("select:eq(1)").val();
//run fc_PreProcess
fc_PreProcess(color, size);
if (size == "" || color == "") {
//do not submit the form
return false;
}
});
</script>
Also posted on Foxycart forums.
http://forum.foxycart.com/comments.php?DiscussionID=195