},\r
\r
isSize : function(s) {\r
- return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');\r
+ return this.test(s, '^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');\r
},\r
\r
isId : function(s) {\r
var i, nl, s = this.settings, c = 0;\r
\r
nl = this.tags(f, 'label');\r
- for (i=0; i<nl.length; i++)\r
+ for (i=0; i<nl.length; i++) {\r
this.removeClass(nl[i], s.invalid_cls);\r
+ nl[i].setAttribute('aria-invalid', false);\r
+ }\r
\r
c += this.validateElms(f, 'input');\r
c += this.validateElms(f, 'select');\r
invalidate : function(n) {\r
this.mark(n.form, n);\r
},\r
+ \r
+ getErrorMessages : function(f) {\r
+ var nl, i, s = this.settings, field, msg, values, messages = [], ed = tinyMCEPopup.editor;\r
+ nl = this.tags(f, "label");\r
+ for (i=0; i<nl.length; i++) {\r
+ if (this.hasClass(nl[i], s.invalid_cls)) {\r
+ field = document.getElementById(nl[i].getAttribute("for"));\r
+ values = { field: nl[i].textContent };\r
+ if (this.hasClass(field, s.min_cls, true)) {\r
+ message = ed.getLang('invalid_data_min');\r
+ values.min = this.getNum(field, s.min_cls);\r
+ } else if (this.hasClass(field, s.number_cls)) {\r
+ message = ed.getLang('invalid_data_number');\r
+ } else if (this.hasClass(field, s.size_cls)) {\r
+ message = ed.getLang('invalid_data_size');\r
+ } else {\r
+ message = ed.getLang('invalid_data');\r
+ }\r
+ \r
+ message = message.replace(/{\#([^}]+)\}/g, function(a, b) {\r
+ return values[b] || '{#' + b + '}';\r
+ });\r
+ messages.push(message);\r
+ }\r
+ }\r
+ return messages;\r
+ },\r
\r
reset : function(e) {\r
var t = ['label', 'input', 'select', 'textarea'];\r
\r
for (i=0; i<t.length; i++) {\r
nl = this.tags(e.form ? e.form : e, t[i]);\r
- for (j=0; j<nl.length; j++)\r
+ for (j=0; j<nl.length; j++) {\r
this.removeClass(nl[j], s.invalid_cls);\r
+ nl[j].setAttribute('aria-invalid', false);\r
+ }\r
}\r
},\r
\r
var s = this.settings;\r
\r
this.addClass(n, s.invalid_cls);\r
+ n.setAttribute('aria-invalid', 'true');\r
this.markLabels(f, n, s.invalid_cls);\r
\r
return false;\r