<commit_before>$(function () {
    $('#registration').validate({
        errorElement: "p",
        errorPlacement: function (error, element) {
            error.appendTo(element.parent()).addClass('help-inline');
            /* element is the invalid element. We want to access the control
             * group, which is that element's parent's parent.
             *
             * Adding an error class colours the entire row red.
             */
            element.parent().parent().removeClass('success').addClass('error');
        },
        success: function (label) {
            /* Similarly, see above comment.
             * Adding a success class colours the entire row green.
             */
            label.parent().parent().removeClass('error').addClass('success');
        }
    });

    $("#send_confirm").validate({
        errorElement: "p",
        errorPlacement: function (error, element) {
            $('#errors').empty();
            error.appendTo("#errors")
                 .addClass("text-error");<commit_msg>signup: Fix and clean up validation highlighting<commit_after>$(function () {
    function highlight(class_to_add) {
        // Set a class on the enclosing control group.
        return function (element) {
            $(element).closest('.control-group')
                .removeClass('success error')
                .addClass(class_to_add);
        };
    }

    $('#registration').validate({
        errorElement: "p",
        errorPlacement: function (error, element) {
            // NB: this is called at most once, when the error element
            // is created.
            error.insertAfter(element).addClass('help-inline');
        },
        highlight:   highlight('error'),
        unhighlight: highlight('success')
    });

    $("#send_confirm").validate({
        errorElement: "p",
        errorPlacement: function (error, element) {
            $('#errors').empty();
            error.appendTo("#errors")
                 .addClass("text-error");
{'fraction_non_alphanumeric': 0.13801694070752366, 'fraction_numerical': 0.0, 'mean_word_length': 1.9836552748885588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5908394', 'n_tokens_mistral': 485, 'n_tokens_neox': 478, 'n_words': 122}