$(document).ready(function () { $('#contactForm').submit(function () { if ($.trim($('#Email1').val()) != '') { if ($('#Email1').val() != $('#Email2').val()) { alert("E-Mail addresses must match!"); return false; } } else { alert("Must be a valid e-mail address!"); return false; } if ($.trim($('#Subject').val()) == '') { alert("You must enter a Subject!"); return false; } if ($.trim($('#Comments').val()) == '') { alert("You must enter a comment!"); return false; } $('#contactForm').attr('action', '/page/contactus'); return true; }); $('#enterpriseForm').submit(function () { if ($.trim($('#Name').val()) == '') { alert("You must enter a name!"); return false; } if ($.trim($('#CompanyName').val()) == '') { alert("You must enter a company name!"); return false; } if ($.trim($('#Email1').val()) != '') { if ($('#Email1').val() != $('#Email2').val()) { alert("E-Mail addresses must match!"); return false; } } else { alert("Must be a valid e-mail address!"); return false; } if ($.trim($('#Site1').val()) == '') { alert("You must enter at least one website!"); return false; } if ($.trim($('#Comments').val()) == '') { alert("You must enter what you would like to accomplish with batchSEARCH!"); return false; } $('#enterpriseForm').attr('action', '/page/enterprise'); return true; }); });