 
    function validateForm() {
        $(".validationErrors").html('');
        $(".validationErrors").hide();

        var hasErrors = false;
        var errors = '<ul>';
        var emailVal = $("#email").val();
        var phoneVal = $("#phone").val()
        var regEx = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

        // Validate existence of email
        if (emailVal == '') {
            hasErrors = true;
            errors += '<li>Email is required.</li>';
        }
        // Validate email is in proper form using regular expression
        else if (regEx.test(emailVal) == false) {
            hasErrors = true;
            errors += '<li>Please enter a valid email address.</li>';
        }

        // Validate existence of phone
        if (phoneVal == '') {
            hasErrors = true;
            errors += '<li>Phone is required.</li>';
        }

        errors = errors + '</ul>';

        // If errors exist, display them and stop the submission
        if (hasErrors) {
            $('.validationErrors').show();
            $('.validationErrors').html(errors);
            return false;
        }
        else {
            return true;
        }
    }
