function DisableErrorGlowOnFocus() { $("input:not([type=submit]):not([type=button]):not([type=radio]):not([type=checkbox]):not([type=file]).disableonfocus").on('focus', function() { $(this).removeClass("formjs-error"); $(this).removeClass("disableonfocus"); }); $("textarea.disableonfocus").on('focus', function() { $(this).removeClass("formjs-error"); $(this).removeClass("disableonfocus"); }); } function customizeCheckbox() { $('.checkbox-group > input:checkbox.formjs-sm').each(function(){ $(this).next('span').addBack().wrapAll(""); }); $( ".checkbox-status > .formjs-sm" ).after( "
" ); $('.checkbox-group > input:checkbox.formjs').each(function(){ $(this).next('span').addBack().wrapAll(""); }); $( ".checkbox-status > .formjs" ).after( "" ); $('.checkbox-group > input:checkbox.formjs-lg').each(function(){ $(this).next('span').addBack().wrapAll(""); }); $( ".checkbox-status > .formjs-lg" ).after( "" ); } function customizeRadio() { $('.radio-group > input:radio.formjs-sm').each(function(){ $(this).next('span').addBack().wrapAll(""); }); $( ".radio-status > .formjs-sm" ).after( "" ); $('.radio-group > input:radio.formjs').each(function(){ $(this).next('span').addBack().wrapAll(""); }); $( ".radio-status > .formjs" ).after( "" ); $('.radio-group > input:radio.formjs-lg').each(function(){ $(this).next('span').addBack().wrapAll(""); }); $( ".radio-status > .formjs-lg" ).after( "" ); } function addArrowToSelect() { $( "select:not([multiple]).formjs-sm" ).after( "" ); $('.select-group > select:not([multiple]).formjs-sm').each(function(){ $(this).next('.select-arrow-sm').addBack().wrapAll(""); }); $( "select:not([multiple]).formjs" ).after( "" ); $('.select-group > select:not([multiple]).formjs').each(function(){ $(this).next('.select-arrow').addBack().wrapAll(""); }); $( "select:not([multiple]).formjs-lg" ).after( "" ); $('.select-group > select:not([multiple]).formjs-lg').each(function(){ $(this).next('.select-arrow-lg').addBack().wrapAll(""); }); } function disableDisabledInputs() { $('.checkbox-group input:disabled.formjs-sm').each(function() { $(this).parent().addClass("disabled"); }); $('.checkbox-group input:disabled.formjs').each(function() { $(this).parent().addClass("disabled"); }); $('.checkbox-group input:disabled.formjs-lg').each(function() { $(this).parent().addClass("disabled"); }); $('.radio-group input:disabled.formjs-sm').each(function() { $(this).parent().addClass("disabled"); }); $('.radio-group input:disabled.formjs').each(function() { $(this).parent().addClass("disabled"); }); $('.radio-group input:disabled.formjs-lg').each(function() { $(this).parent().addClass("disabled"); }); $("input:not([type=submit]):not([type=button]):not([type=radio]):not([type=checkbox]):not([type=file]).disabled").attr("disabled", true); $("textarea.disabled").attr("disabled", true); } window.onbeforeunload = function disable() { var inputs = document.getElementsByTagName("INPUT"); for (var i = 0; i < inputs.length; i++) { if (inputs[i].type == "button" || inputs[i].type == "submit") { inputs[i].disabled = true; } } } function runFormJS() { DisableErrorGlowOnFocus(); customizeCheckbox(); customizeRadio(); addArrowToSelect(); disableDisabledInputs(); } // run Form JS runFormJS();