PageSourceSearch

https://www.vcnnetwork.org/lib/js/bti-form.js

js vcnnetwork.org collected 2026-09-29 13:46:34 UTC 4,799 bytes, 143 lines download raw bytes

1(function($){
2	var flexibleValue = $('.bti-flexible-box').val();
3
4	$(function(){
5		var body = $("body");
6
7		// Email and password confirm fields
8		body.delegate(".bti-has-confirm", "blur initField", function(e){
9			var el = $(this),
10				value = el.val(),
11				matchValue = $("#" + el.attr("match")).val(),
12				msgDiv = $("#" + el.attr("msgDiv"));
13
14			if (value != "" && matchValue != "" && value != matchValue) {
15				msgDiv.show();
16			} else {
17				msgDiv.hide();
18			}
19		}).delegate(".bti-toggle-vis-field", "click initField", function(){
20			var field = $(this);
21			var props = getFieldProperties(field);
22			var target = $(field.attr("targetel"));
23
24			// Toggle the visibility of the target based on the field type.
25			if(props.type === "checkbox") {
26				target.toggle(field[0].checked);
27			} else if (props.type === "radio") {
28				if(field[0].checked) {
29					var value = field.val().toLowerCase();
30					// Try to evaluate the checked value as a boolean.  If possible, show/hide the target based on the value.
31					target.toggle(stringToBoolean(value));
32				}
33			}
34		})
35		.delegate(".bti-flexible-box,.bti-flexible-checkbox","click initField", function(){
36			var field = $(this);
37			var props = getFieldProperties(field);
38			var target = $("." + field.attr("targetel"));
39
40			if(props.type === "checkbox" && field.is(':checked')) {
41				target.val('');
42			} else if(props.type === "text" && field.val() !== ""){
43				target.attr("checked", false);
44			}
45		})
46		.delegate('input:radio[name="mentor.makeInactive"]', "click", function(){
47			if($(this).val() === "1"){
48				$("input:text[name='mentor.EngagementLimit']").val("0");
49			}
50		})
51		.delegate("input[name='mentor.agreement'], input[name='mentor.agreement2'], input[name='mentor.agreement3'], input[name='person.agreement2']", "change", function(){
52			var showMessage = false,
53				submitBtn = $('input[type=submit]'),
54				agreement = $("#agreementWarning"),
55				el = $(this);
56			if(el.val() === '0'){
57				showMessage = true;
58			}
59
60			if(showMessage) {
61				agreement.show();
62				submitBtn.attr('disabled', true);
63				if(typeof agreement.data("showpopup") !== 'undefined'){
64					var params = {
65							title : "Alert",
66							message : agreement.html()
67						};
68					$.btiAlert(params,null);
69				}
70			} else {
71				agreement.hide();
72				submitBtn.attr('disabled', false);
73			}
74		})
75		.on("click change keyup", "#employerUser_email-confirm", function(e){
76			var el = $(this);
77			if(el.data('ismobilebrowser') && $("#employerUser_email").val().charAt(0).match(/[A-Z]/) === null){
78				var elval = el.val(),
79					firstChar = elval.charAt(0).toLowerCase(),
80					restChars = elval.substring(1);
81				el.val(firstChar + restChars);
82			}
83		})
84		.on("click","#ncaasfa-js-agreement-link", function(e){
85			$("#ncaasfa-js-agreement").prop("checked","checked");
86			$('input[type=submit]').attr('disabled', false);
87		}).
88		on("click", ".CPTC-hover", function(e){
89			var params = {
90					title : "What is CPTC",
91					message : "Certified Professional Technical Communicator (CPTC&#8482;) is a professional certification program developed by the Society for Technical Communication.  CPTC designation validates the skills, knowledge, and competence of technical communicators as well as verifies their continued training and currency with developments in the field. Click <a href='https://www.stc.org/certification/' target='_blank'>here</a> to find out more about becoming certified."
92				};
93			$.btiAlert(params,null);
94		});
95
96		$("#BTIframework").submit(function(e){
97			var ncaasfa_agreement = $("#ncaasfa-js-agreement");
98			if(ncaasfa_agreement.length === 0 ){
99				return true;
100			}
101
102			if(ncaasfa_agreement.prop("checked")){
103				return true;
104			}
105			else{
106				var params = {
107							title : "Alert",
108							message : "You must agree the Term and Conditions of Use before proceeding"
109						};
110				$.btiAlert(params,null);
111				return false;
112			}
113		});
114
115		// Init field handlers
116		$("input").trigger("initField");
117		checkFlexibleChanged();
118	});
119
120
121	function checkFlexibleChanged() {
122	    var currentValue = $('.bti-flexible-box').val();
123	    if ((currentValue) && currentValue != flexibleValue && currentValue != '') {
124	    	flexibleValue = 'dummy';
125	        $('.bti-flexible-checkbox').attr("checked", false);
126	    }
127
128	    setTimeout(checkFlexibleChanged, 1000);
129	}
130
131	function stringToBoolean(value) {
132		value = value.toLowerCase();
133		return value === "true" || value === "1" || value === "yes";
134	}
135
136	function getFieldProperties(field) {
137		return {
138			tag : field[0].nodeName.toLowerCase(),
139			type : field[0].type.toLowerCase(),
140			isMulti : typeof field[0].multiple !== "undefined" ? field[0].multiple : false
141		};
142	}
143})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.