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 '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 allowed '
},
"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": {
// Simplified, was not working in the Iphone browser
"regex": /^([A-Za-z0-9_\-\.\'\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,6})$/,
"alertText": "* " + 'email address is not valid'
},
"onlyLetterNumberUnderscore": {
"regex": /^[0-9a-zA-Z_]+$/,
"alertText": "* "+'Only Letter, Number and Underscore 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']= 'http://ethicscan.ca/wp-admin/admin-ajax.php';
$("#wp_emember_regoForm").validationEngine('attach');
});