add_action('wp_footer', function () { echo ''; }, 99); add_action('wp_footer', function () { echo ''; }, 99); jQuery(document).ready(function($){ window['emember_form_builder_checkbox'] = function (field, rules, i, options){ var id = field.attr('id').split('-'); id.pop(); id = id.join('-'); var count = 0; jQuery("." + id).each(function(){ var checked = jQuery(this).attr('checked'); if(checked) count++; }); if(count<1) return 'Questo campo è richiesto '; } $.validationEngineLanguage = { newLang: function(){ $.validationEngineLanguage.allRules = { "required": { // Add your regex rules here, you can take telephone as an example "regex": "none", "alertText": "* " + 'Questo campo è richiesto ', "alertTextCheckboxe": "* " + 'Questo campo è richiesto ' }, "minSize": { "regex": "none", "alertText": "* " +'Minimo ', "alertText2": " "+'caratteri consentiti ' }, "equals": { "regex": "none", "alertText": "* "+'I campi non corrispondono ' }, "phone": { // credit: jquery.h5validate.js / orefalo "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, "alertText": "* Invalid phone number" }, "email": { //The old regex wasn't working for address like test@test.careers "regex": /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, "alertText": "* " + 'indirizzo email non valido' }, "onlyLetterNumberUnderscore": { "regex": /^[0-9a-zA-Z_]+$/, "alertText": "* "+'Sono consentiti solo Lettere, Numeri e Underscore' }, "noapostrophe": { "regex": /^[^\']+$/, "alertText": "* " + 'Apostrophe character is not allowed.' }, "ememberUserName": { "regex": /^[a-zA-Z0-9@_\.-]+$/, "alertText": "* "+'Letter, number, underscore or email allowed. ' }, "ajaxUserCall": { "url": "ajaxurl", // you may want to pass extra data on the ajax call "extraData": "&event=check_name&action=check_name", "alertText": "* "+'Questo nome è già utilizzato', "alertTextOk": "* "+'Questo nome è disponibile', "alertTextLoad": "* "+'Convalidando, attendere prego' } }; } }; $.validationEngineLanguage.newLang(); $.validationEngineLanguage.allRules['ajaxUserCall']['url']= 'https://cientro.it/wp-admin/admin-ajax.php'; $("#wp_emember_regoFormWithConfirmation").validationEngine('attach'); });