General Category => EasyUI for jQuery => Topic started by: devnull on February 04, 2015, 08:14:32 PM
Title: validator permitted chars
Post by: devnull on February 04, 2015, 08:14:32 PM
is this the most efficient way of preventing illegal chars with the validator:
Code:
$.extend($.fn.validatebox.defaults.rules, { sqlsafe: { validator: function(val,par){ var reg = new RegExp(/[A-Z]|[0-9]|-|\/|\\/); for(var i in val){ $(this).validatebox.defaults.rules.sqlsafe.message = '"'+val[i]+'" character not permitted.'; if(!reg.test(val[i])) return false; } return true; } } });