<commit_before>(function () {
	'use strict';

	mare.views.SiteVisitorRegistration = Backbone.View.extend({
		el: '.site-visitor-registration',

		events: {
			'change .other-way-to-hear-about-mare': 'toggleOtherWayToHearTextField'
		},

		initialize: function() {
			// DOM cache any commonly used elements to improve performance
			this.$howDidYouHearOther = this.$('#site-visitor-how-did-you-hear-other');
		},

		toggleOtherWayToHearTextField: function toggleOtherWayToHearTextField() {
			this.$howDidYouHearOther.toggleClass('hidden');
		}

	});
})();<commit_msg>Add form validation to the site user view using Parsley.<commit_after>(function () {
	'use strict';

	mare.views.SiteVisitorRegistration = Backbone.View.extend({
		el: '.registration-form--site-visitor',

		events: {
			'change .other-way-to-hear-about-mare': 'toggleOtherWayToHearTextField'
		},

		initialize: function() {
			// DOM cache any commonly used elements to improve performance
			this.$howDidYouHearOther = this.$('#site-visitor-how-did-you-hear-other');
			// Initialize parsley validation on the form
			this.form = this.$el.parsley();
			this.form.on('field:validated', this.validateForm);
		},

		toggleOtherWayToHearTextField: function toggleOtherWayToHearTextField() {
			this.$howDidYouHearOther.toggleClass('hidden');
		},

		validateForm: function validateForm() {
			var ok = $('.parsley-error').length === 0;
			$('.bs-callout-info').toggleClass('hidden', !ok);
			$('.bs-callout-warning').toggleClass('hidden', ok);

			// need to add a check to show site-visitor-how-did-you-hear-error if no checkboxes are checked
		}

	});
})();
{'fraction_non_alphanumeric': 0.15446153846153846, 'fraction_numerical': 0.0006153846153846154, 'mean_word_length': 4.313725490196078, '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': '1551557', 'n_tokens_mistral': 575, 'n_tokens_neox': 504, 'n_words': 99}