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).prop('checked'); if(checked) count++; }); if(count<1) return 'This field is required '; } $.validationEngineLanguage = { newLang: function(){ $.validationEngineLanguage.allRules = { "required": { // Add your regex rules here, you can take telephone as an example "regex": "none", "alertText": "* " + 'This field is required ', "alertTextCheckboxe": "* " + 'This field is required ' }, "minSize": { "regex": "none", "alertText": "* " +'Minimum ', "alertText2": " "+'characters required ' }, "equals": { "regex": "none", "alertText": "* "+'Fields do not match ' }, "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": "* " + 'email address is not valid' }, "onlyLetterNumberUnderscore": { "regex": /^[0-9a-zA-Z_]+$/, "alertText": "* "+'Only Letter, Number and Underscore allowed' }, "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": "* "+'This user is already taken', "alertTextOk": "* "+'This name is available', "alertTextLoad": "* "+'Validating, please wait' } }; } }; $.validationEngineLanguage.newLang(); $.validationEngineLanguage.allRules['ajaxUserCall']['url']= 'https://mindfulnessinschools.org/wp-admin/admin-ajax.php'; $("#wp_emember_regoForm").validationEngine('attach'); });