equal
deleted
inserted
replaced
1 /** |
1 /** |
2 * $Id: validate.js 520 2008-01-07 16:30:32Z spocke $ |
2 * $Id: validate.js 758 2008-03-30 13:53:29Z spocke $ |
3 * |
3 * |
4 * Various form validation methods. |
4 * Various form validation methods. |
5 * |
5 * |
6 * @author Moxiecode |
6 * @author Moxiecode |
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
7 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
29 isAbsUrl : function(s) { |
29 isAbsUrl : function(s) { |
30 return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$'); |
30 return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$'); |
31 }, |
31 }, |
32 |
32 |
33 isSize : function(s) { |
33 isSize : function(s) { |
34 return this.test(s, '^[0-9]+(px|%)?$'); |
34 return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$'); |
35 }, |
35 }, |
36 |
36 |
37 isId : function(s) { |
37 isId : function(s) { |
38 return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$'); |
38 return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$'); |
39 }, |
39 }, |
108 invalidate : function(n) { |
108 invalidate : function(n) { |
109 this.mark(n.form, n); |
109 this.mark(n.form, n); |
110 }, |
110 }, |
111 |
111 |
112 reset : function(e) { |
112 reset : function(e) { |
113 var t = new Array('label', 'input', 'select', 'textarea'); |
113 var t = ['label', 'input', 'select', 'textarea']; |
114 var i, j, nl, s = this.settings; |
114 var i, j, nl, s = this.settings; |
115 |
115 |
116 if (e == null) |
116 if (e == null) |
117 return; |
117 return; |
118 |
118 |