");
dtm_track('formSubmit',{formID: 'FP_20150410_Automotive_Contact_Us'});
},
//Default http error handling, note this function only applies to http errors not form processor errors, for that please override "handleErrors"
handleHttpErrors: function (jqXHR, textStatus, errorThrown) {
if (this.settings.region in submissionFailedErrors) {
this.$formErrorMessages.show().text(submissionFailedErrors[this.settings.region]);
} else {
this.$formErrorMessages.show().text(submissionFailedErrors['en_us']);
}
},
//Default error handling, note this function only applies to form processor errors, NOT http errors, for that please override "handleHttpErrors"
handleErrors: function (response) {
var formID = response.formID
var fields = response.data;
var errors = [];
for (var field in fields) {
if (fields.hasOwnProperty(field)) {
var datum = fields[field];
if (datum.status != 'SUCCESS') {
errors.push({name: datum.name, value: datum.value, errors: datum.messages});
}
}
}
//Find and show outstanding errors
$.each(errors, function (index, error) {
if (error.errors.join) {
$('#' + formID + ' .fp-field-error-' + error.name).show().html(error.errors.join('
'));
}
$('#' + formID + ' .fp-field-error-' + error.name).closest('.fp-container').addClass('fp-container--error');
});
//Show any form level errors that we might have
if (response.messages.length > 0) {
this.$formErrorMessages.show().html(response.messages.join('
'));
}
}
});
//Wire up the jquery plugin
$.fn[pluginName] = function (options) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Plugin(this, options));
}
});
};
})(jQuery, window, document);
;
(function ($, window, document, undefined) {
"use strict";
var pluginName = "addFormProcessorErrorElements",
defaults = {};
function Plugin(element, options) {
this.element = element;
this.$formElement = $(element);
this.settings = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
$.extend(Plugin.prototype, {
init: function () {
var that = this;
that.addMainFormError();
that.addFieldErrors();
}, addMainFormError: function () {
this.$formElement.find('#fieldList').before('
');
}, addFieldErrors: function () {
var that = this;
this.$formElement.find('input[type=text], select, input[type=hidden], textarea, dobDay, dobMonth, dobYear').each(function () {
var $this = $(this);
var name = $(this).attr('name').replace("[]", "");
$this.after('
');
});
this.$formElement.find('input[type=checkbox]').each(function (index) {
//this.$formElement.find('input[name*="AreaInterest"]').each(function (index) {
var $this = $(this);
var name = $(this).attr('name').replace("[]", "");
var id = $(this).attr('id');
if(index == 0 || index == 14)$this.before('
');
$this.next('label').after('
');
});
this.$formElement.find('dobDay').each(function () {
var $this = $(this);
var name = $(this).attr('name').replace("[]", "");
var id = $(this).attr('id');
$this.next('label').after('
');
});
}
});
//Wire up the jquery plugin
$.fn[pluginName] = function (options) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Plugin(this, options));
}
});
};
})(jQuery, window, document);
jQuery(document).ready(function ($) {
var $form = $('.fp').addFormProcessorErrorElements().formProcessor({
handleSuccess: function (data) {
if (data.formID == "#FP_20150410_Automotive_Contact_Us") {
$('.fp').replaceWith("
" + data.messages.join(". ") + "
")
try {
/* nvEventTracker('Forms|Submission', 'FP_20170525_deep_learning_ebook_company', '', '0', 'TRUE'); */
/*dtm_track('formSubmit', {formID: 'FP_20190320_TREX_EDU_Discount'});*/
} catch (e) {
}
}
},
handleHttpErrors: function (jqXHR, textStatus, errorThrown) {
console.log(this.$formErrorMessages);
this.$formErrorMessages.show().text(textStatus);
this.$formfieldErrorMessages.show().text(textStatus);
}
});
});
";
if (!$(".domainVerification").length) {
$('#FP_20150410_Automotive_Contact_Us_email').attr("data-type", "warning");
$('#FP_20150410_Automotive_Contact_Us_email').addClass("is-wrong");
jQuery('input[type="submit"]').prop('disabled', true).css('opacity', '0.6');
$(".domainVerificationField").val("");
var i = $("h4.fp-formTitle").next();
i.length > 0 ? i.after('
');
}
} else {
$(".domainVerificationField").val(1);
$(".domainVerification").remove();
jQuery('input[type="submit"]').prop('disabled', false).css('opacity', '1');
$('#FP_20150410_Automotive_Contact_Us_email').removeClass("is-wrong");
$('#FP_20150410_Automotive_Contact_Us_email').removeAttr("data-type");
}
});*/