<commit_before>$(function() {
    $('[data-required-form]').each(function() {
        var $this = $(this);
        var $checkboxes = $this.find(':checkbox[required]');
        var $textareas = $this.find('textarea[required]');
        var $inputs = $this.find('input[type="text"][required]');
        var $submit = $this.find('[type="submit"]');

        var validate = function() {
            var allChecked = true;
            $checkboxes.each(function() {
                allChecked = allChecked && $(this).is(':checked');
            });
            $textareas.each(function() {
                allChecked = allChecked && $(this).val().length > 0
            });
            $inputs.each(function() {
                allChecked = allChecked && $(this).val().length > 0
            });
            if (typeof grecaptcha !== 'undefined') {
                allChecked = allChecked && grecaptcha.getResponse().length > 0;
            }
            if (allChecked) {
                $submit.removeAttr('disabled');
            } else {
                $submit.attr('disabled', 'disabled');
            }
        };
        onCaptchaLoadCallback = function() {
            grecaptcha.render('g-recaptcha',
            {
             callback: validate,
             sitekey: '<KEY>'
            });
        };

        $this.attr('novalidate', 'novalidate');
        $this.on('input, change', '[required]', validate);
        validate();
    });

    $('[previous-event-form]').each(function() {
        var $this = $(this);
        var $submit = $this.find('[type="submit"]');
        var $radio = $this.find('input[name=previous_event-has_organized_before]');<commit_msg>Create the onCaptchaLoadCallback before page loads, otherwise if Recaptcha loads first, it will error and won't allow form validation<commit_after>window.captchaConf = {
 callback: function() { },
 sitekey: '<KEY>'
};

window.onCaptchaLoadCallback = function() {
  grecaptcha.render('g-recaptcha', window.captchaConf);
};

$(function() {
    $('[data-required-form]').each(function() {
        var $this = $(this);
        var $checkboxes = $this.find(':checkbox[required]');
        var $textareas = $this.find('textarea[required]');
        var $inputs = $this.find('input[type="text"][required]');
        var $submit = $this.find('[type="submit"]');

        var validate = function() {
            var allChecked = true;
            $checkboxes.each(function() {
                allChecked = allChecked && $(this).is(':checked');
            });
            $textareas.each(function() {
                allChecked = allChecked && $(this).val().length > 0
            });
            $inputs.each(function() {
                allChecked = allChecked && $(this).val().length > 0
            });
            if (typeof grecaptcha !== 'undefined') {
                allChecked = allChecked && grecaptcha.getResponse().length > 0;
            }
            if (allChecked) {
                $submit.removeAttr('disabled');
            } else {
                $submit.attr('disabled', 'disabled');
            }
        };
        window.captchaConf.callback = validate;

        $this.attr('novalidate', 'novalidate');
        $this.on('input, change', '[required]', validate);
        validate();
    });

    $('[previous-event-form]').each(function() {
        var $this = $(this);
        var $submit = $this.find('[type="submit"]');
        var $radio = $this.find('input[name=previous_event-has_organized_before]');
{'fraction_non_alphanumeric': 0.17172295363480253, 'fraction_numerical': 0.0017172295363480253, 'mean_word_length': 2.071177504393673, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4094876', 'n_tokens_mistral': 996, 'n_tokens_neox': 963, 'n_words': 171}