twitter bootstrap - jQuery validation regex for white space getting a "Uncaught TypeError: Cannot call method 'call' of undefined error" -
here jquery code per previous stackoverflow question
$('#productid').validate({ rules: { product: { required: true, term: {regex: /^$|\s/} } }, messages: { product: { required: "a text much", term: "please avoid spaces" }, }, showerrors: function (errormap, errorlist) { $.each(this.successlist, function (index, value) { $('#'+value.id+'').popover('destroy'); }); $.each(errorlist, function (index, value) { $('#'+value.element.id+'').attr('data-content',value.message, 'title', 'oops!').popover({ placement: 'top', trigger: 'manual', delay: { show: 500, hide: 5000 } }).popover('show'); }); } }); what trying show popover if there white space in term entered. every time gives me error
uncaught typeerror: cannot call method 'call' of undefined i know wrong regex part. because tried same code minlength , worked well. doing wrong?
p.s using twitter bootstrap popover.
update: more error
uncaught typeerror: cannot call method 'call' of undefined ----------jquery.validate.js:504 $.extend.check ---------- jquery.validate.js:504 $.extend.element ---------- jquery.validate.js:357 $.extend.defaults.onfocusout ---------- jquery.validate.js:231 delegate ---------- jquery.validate.js:317 (anonymous function) ---------- jquery.validate.js:1184 jquery.event.dispatch ---------- jquery.js:3075 elemdata.handle ---------- jquery.js:2751 jquery.event.trigger ---------- jquery.js:2987 jquery.event.simulate ---------- jquery.js:3302 handler
my guess should using this.errorlist instead of errorlist in second $.each. it's possible difference between 2 loops in value.id , value.element.id significant too.
Comments
Post a Comment