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

	mare.views.SocialWorkerRegistration = Backbone.View.extend({
		el: '.form--social-worker-registration',

		events: {
			'change .social-worker-title-checkbox': 'toggleSocialWorkerTitleTextField'
		},

		initialize: function() {
			// DOM cache any commonly used elements to improve performance
			this.$socialWorkerTitle = this.$('#social-worker-title');
			this.$socialWorkerTitleGroup = this.$('.social-worker-title-group');
			// Initialize parsley validation on the form
			this.form = this.$el.parsley();
			// Bind the hidden 'title' text box for use in binding/unbinding validation
			this.socialWorkerTitleValidator = this.$socialWorkerTitle.parsley();
			// DOM cache the Parsley validation message for the hidden 'other' field for use in binding/unbinding validation
			this.$socialWorkerTitleErrorMessage = this.$socialWorkerTitle.next();

			this.form.on('field:validated', this.validateForm);
		},

		toggleSocialWorkerTitleTextField: function toggleSocialWorkerTitleTextField() {
			// Hide/show the hidden 'other' field via the hidden class
			this.$socialWorkerTitleGroup.toggleClass('hidden');

			if(this.$socialWorkerTitleGroup.hasClass('hidden')) {
				// Clear out the input box since it's hidden and not part of the form submission
				this.$socialWorkerTitle.val('');
				// Remove the validation binding
				this.$socialWorkerTitle.attr('data-parsley-required', 'false');
				// Reset validation on the field.  If it was already validated, we need to clear out the check so the form can be submitted
				this.socialWorkerTitleValidator.reset();
			} else {
				// Add validation binding
				this.$socialWorkerTitle.attr('data-parsley-required', 'true');
				// Create a custom error message to display if validation fails
				this.$socialWorkerTitle.attr('data-parsley-error-message', 'required');
			}
		},

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

	});
}());<commit_msg>#113 | fix bug prevent social worker registering with missing title<commit_after>(function () {
	'use strict';

	mare.views.SocialWorkerRegistration = Backbone.View.extend({
		el: '.form--social-worker-registration',

		events: {
			'change .social-worker-title-checkbox': 'toggleSocialWorkerTitleTextField'
		},

		initialize: function() {
			// DOM cache any commonly used elements to improve performance
			this.$socialWorkerTitle = this.$( '#social-worker-title' );
			this.$socialWorkerTitleGroup = this.$( '.social-worker-title-group' );
			// Initialize parsley validation on the form
			this.form = this.$el.parsley();
			// Bind the hidden 'title' text box for use in binding/unbinding validation
			this.socialWorkerTitleValidator = this.$socialWorkerTitle.parsley();
			// DOM cache the Parsley validation message for the hidden 'other' field for use in binding/unbinding validation
			this.$socialWorkerTitleErrorMessage = this.$socialWorkerTitle.next();

			this.form.on( 'field:validated', this.validateForm );
		},

		toggleSocialWorkerTitleTextField: function toggleSocialWorkerTitleTextField() {
			// Hide/show the hidden 'other' field via the hidden class
			this.$socialWorkerTitleGroup.toggleClass( 'hidden' );

			if( this.$socialWorkerTitleGroup.hasClass( 'hidden' ) ) {
				// Clear out the input box since it's hidden and not part of the form submission
				this.$socialWorkerTitle.val( '' );
				// Remove the validation binding
				this.$socialWorkerTitle.attr( 'data-parsley-required', 'false' );
				// Reset validation on the field.  If it was already validated, we need to clear out the check so the form can be submitted
				this.socialWorkerTitleValidator.reset();
			} else {
				// Add validation binding
				this.$socialWorkerTitle.attr( 'data-parsley-required', 'true' );
			}
		},

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

	});
}());
{'fraction_non_alphanumeric': 0.12982625482625482, 'fraction_numerical': 0.0012065637065637065, 'mean_word_length': 4.024242424242424, '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': '2641770', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1113, 'n_words': 322}