jQuery(document).ready(function(){
jQuery.validator.addMethod("customNote", function(value, element) {
if((jQuery("#additionalRsvp").val() > 0) && (jQuery("#note").val() == "")) {
return false;
}
return true;
}, "
Please enter an email address that we can use to contact you about the extra guest. We have to keep a pretty close eye on the number of attendees. Thanks!");
jQuery("#rsvpForm").validate({
rules: {
note: "customNote",
newAttending1LastName: "required",
newAttending1FirstName: "required",
newAttending2LastName: "required",
newAttending2FirstName: "required",
newAttending3LastName: "required",
newAttending3FirstName: "required"
},
messages: {
note: "
If you are adding additional RSVPs please enter your email address in case we have questions",
newAttending1LastName: "
Please enter a last name",
newAttending1FirstName: "
Please enter a first name",
newAttending2LastName: "
Please enter a last name",
newAttending2FirstName: "
Please enter a first name",
newAttending3LastName: "
Please enter a last name",
newAttending3FirstName: "
Please enter a first name"
}
});
/* First step, where they search for a name */
jQuery("#rsvp").validate({
rules: {
firstName: "required",
lastName: "required"
},
messages: {
firstName: "
Please enter your first name",
lastName: "
Please enter your last name"
}
});
jQuery("#addRsvp").click(function() {
handleAddRsvpClick();
});
});