');
// Check for duplicate ellucian account | lStorage.removeAll();
var updateFrmButtons = function () {
// Update
if ( jQuery.localStorage.isSet("recruit5>personGuid") && jQuery.localStorage.get("recruit5>personGuid").length > 0 ) {
jQuery(".js-has-dupe").removeClass("hidden");
jQuery("#btnSubmit").val("Submit");
jQuery("#personGuid").val(jQuery.localStorage.get("recruit5>personGuid"));
// New
} else {
jQuery(".js-has-dupe").addClass("hidden");
jQuery("#btnSubmit").val("Submit");
jQuery("#personGuid").val("");
}
}
// Check for duplicate account in recruit
var checkDupAcct = function () {
// Check if fields are on the page (When API is down form fields are not shown) | Check local storage is different than forms
if ( jQuery('#firstname').length > 0 && jQuery('#firstname').val().length > 0 && jQuery('#lastname').val().length > 0 && jQuery('#emailaddress1').val().length > 0 ) {
if ( jQuery.localStorage.get("recruit5>firstName") != jQuery('#firstname').val() || jQuery.localStorage.get("recruit5>lastname") != jQuery('#lastname').val() || jQuery.localStorage.get("recruit5>emailaddress1") != jQuery('#emailaddress1').val() ) {
// Set Local Storage Variables
jQuery.localStorage.set("recruit5>firstName", jQuery('#firstname').val());
jQuery.localStorage.set("recruit5>lastname", jQuery('#lastname').val());
jQuery.localStorage.set("recruit5>emailaddress1", jQuery('#emailaddress1').val());
jQuery.ajax({
type: "POST",
cache: false,
url: "/customcf/degrees/cfc/recruiter.cfc?method=apiCheckDupAcct",
data: { firstName: jQuery('#firstname').val(), lastName: jQuery('#lastname').val(), emailAddress: jQuery('#emailaddress1').val() },
dataType: "json"
})
.done(function(data) {
if ( data["ISSUCCESS"] === true && typeof(data["RESULTS"]["personGuid"]) === "string" ) { // undefined
jQuery.localStorage.set("recruit5>personGuid", data["RESULTS"]["personGuid"]);
} else {
jQuery.localStorage.set("recruit5>personGuid", "");
}
updateFrmButtons();
})
// If it fails, let's treat as new
.fail(function(data) {
jQuery.localStorage.set("recruit5>personGuid", "");
updateFrmButtons();
});
} else {
// Use Local Storage
updateFrmButtons();
}
}
}
// Ready
jQuery(function(){
// 03/24/2021 - Used to verify if we are in the Funnelback Program Page - Thank you URL is not used here - Always show inline modal thank you
var formTypeAttr = jQuery('#js_thanks').attr('data-formType');
var currentPage = window.location.href;
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B #a26_a26webreferrer').val(currentPage);
// Wait 1.5 seconds to check for duplicate account
setTimeout( function() { checkDupAcct(); }, 1500);
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').on('change','#datatel_academicprogramofinterestid', function(){
/*** Start of Term of Entry ***/
acadTermList = jQuery(this).find(':selected').data('program-term');
// Loop Academic Term Options, disable the ones that do not belong to selected program
jQuery("#datatel_anticipatedentrytermid > option").each(function() {
// Show Value
if ( acadTermList.indexOf(this.value) >= 0 ) {
jQuery(this).prop("disabled", false).show();
// Hide Value
} else {
jQuery(this).prop("disabled", true).hide();
}
});
// Set default to "choose anticipated term of entry" if field is visible | hidden field = hardcoded unsure guid
if ( jQuery("#datatel_anticipatedentrytermid").is(':visible') ) {
// Set default to
jQuery("#datatel_anticipatedentrytermid").val("").change();
}
/*** End of Term of Entry ***/
/*** Start of Program Options | INC0294450 - 10/27/21 - Deprecated ***/
/*
programOptionList = jQuery(this).find(':selected').data('program-option');
// Loop Academic Term Options, disable the ones that do not belong to selected program
jQuery("#a26_programoptions > option").each(function() {
// Show Value
if ( programOptionList.indexOf(this.value) >= 0 ) {
jQuery(this).prop("disabled", false).show();
// Hide Value
} else {
jQuery(this).prop("disabled", true).hide();
}
});
*/
// TO DO: Hide if there are no visible select options for selected program. Could be a data issue | pending check with Spexs
// Set default to empty
//jQuery("#a26_programoptions").val("").change();
/*** End of Program Options ***/
});
// Check Duplicate Account when first, last and email changes
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').on('change','#emailaddress1,#firstname,#lastname', function(){
checkDupAcct();
});
// Form Submission - Create New | Erase personGUID Value
jQuery('#ahrefSubmit').on('click', function(e) {
e.preventDefault();
// Check if form validates, if does not submit issue a click on the submit button which is the only way to trigger the form validation
if ( jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B')[0].checkValidity() ) {
jQuery("#personGuid").val("");
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').submit();
} else {
jQuery('#btnSubmit').trigger('click');
}
});
// FORM Submission
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').submit(function(e){
e.preventDefault();
var school = jQuery('#js_school').val();
//var dept = jQuery('#js-dept').val();
if ( jQuery('option:selected', '#datatel_academicprogramofinterestid').length > 0 ) {
var program = jQuery('option:selected', '#datatel_academicprogramofinterestid').data('programCode');
} else {
var program = jQuery('#datatel_academicprogramofinterestid').data('programCode');
}
if ( jQuery('option:selected', '#datatel_anticipatedentrytermid').length > 0 ) {
var term = jQuery('option:selected', '#datatel_anticipatedentrytermid').text();
} else {
var term = jQuery('#datatel_anticipatedentrytermid').data('term');
}
var label = school + ' - ' + program + ' - ' + term;
var act = 'submit-rfi';
var cat = 'recruit-v5';
// Disable submit button
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').find(":submit").prop("disabled", true);
loadingHTML.insertAfter(jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').find(":submit"));
// Hide Error Message
jQuery("#recFrmError").empty();
if ( ! jQuery("#recFrmError").hasClass("hidden") ) {
jQuery("#recFrmError").addClass("hidden").attr('aria-hidden',true);
}
// Serialize the form data.
var formData = jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').serialize();
// Submit Request
jQuery.ajax({
type: "POST",
url: "/customcf/degrees/cfc/recruiter.cfc?method=submitRecruitFrm",
cache: false,
dataType: "json",
data: formData
})
.done(function(data) {
if ( data["ISSUCCESS"] === true ) {
// Thank You URL | Validate URL | ?ty=1533569963525&s=l | tyURL.length > 0 &&
var tyURL = jQuery('#js_thanks').val();
AU.analytics.trackEvent(label, act, cat, true);
jQuery("fieldset").html('
Processing...
');
// Set Local Storage Variables
jQuery.localStorage.set("recruit5>firstName", jQuery('#firstname').val());
jQuery.localStorage.set("recruit5>lastname", jQuery('#lastname').val());
jQuery.localStorage.set("recruit5>emailaddress1", jQuery('#emailaddress1').val());
// 03/24/2021 - Funnelback Programs | Display in modal thank you message | use data-formType and check for Funnelback Program Finder
if ( formTypeAttr == 'Funnelback Program Finder' ) {
// Enable submit button
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').find(":submit").prop("disabled", false);
jQuery(".modal-title").addClass("hidden");
jQuery("#rfiHeadText").addClass("hidden");
jQuery("fieldset").html('
Thank You for your interest.
Someone will be in touch very soon.
');
// Redirect to thank you URL
} else if ( tyURL.length > 0 && tyURL.match(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g) != null ) {
if ( tyURL.match(/\?./) ) {
tyURL = tyURL + '&ty=' + new Date().getTime();
} else {
tyURL = tyURL + '?ty=' + new Date().getTime();
}
top.location.assign(tyURL);
// Display in modal thank you message
} else {
// Enable submit button
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').find(":submit").prop("disabled", false);
jQuery("#rfiHeadText").addClass("hidden");
jQuery("fieldset").html('
Thank You for your interest.
Someone will be in touch very soon.
Be sure to check out We Know Success to learn more about the exciting outcomes our graduates have seen.
');
}
} else {
// Enable submit button
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').find(":submit").prop('disabled', false);
loadingHTML.remove();
// Error Messages
if ( data["ERRORS"].length > 0 ) {
jQuery.each(data["ERRORS"], function(index, value) {
if ( jQuery('ul', '#recFrmError').length '));
};
jQuery("#recFrmError ul").append('
' + value + '');
});
jQuery("#recFrmError").removeClass("hidden").attr('aria-hidden',false);
}
// Reset personGUID in case it got erased by the "create a new request link"
updateFrmButtons();
}
})
.fail(function(data) {
// Enable submit button
jQuery('#form-A774A8A5-93FC-EE83-0646E28A54386D9B').find(":submit").prop('disabled', false);
loadingHTML.remove();
if ( jQuery('ul', '#recFrmError').length '));
};
jQuery("#recFrmError ul").append('
Sorry, an error has occurred, please try again.');
jQuery("#recFrmError").removeClass("hidden").attr('aria-hidden',false);
// Reset personGUID in case it got erased by the "create a new request link"
updateFrmButtons();
});
});
});