source: admin/WebConsole/jscripts/validators.js @ efe8ac7

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since efe8ac7 was 3b3043b, checked in by adv <adv@…>, 14 years ago

version 1.0.1 #270 #390 validado formulario alta/modificacion objeto imagen

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2008 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 * Copyright (C) 2011 Daniel Garcia <danigm@wadobo.com>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19
20function validate_expr(value, epx) {
21        var expr = new RegExp(epx);
22        return (value.search(expr) == 0);
23}
24
25function validate_number(value) {
26        return validate_expr(value, "^\\d*$");
27}
28
29function validate_alphanum(value) {
30        return validate_expr(value, "^\\w*$");
31}
32
33function validate_notnull(value) {
34        return validate_expr(value, "^.+$") && !validate_expr(value, "^\\s*0\\s*$");
35}
36
37function validate_number_notnull(value) {
38        return validate_number(value) && validate_notnull(value);
39}
40
41function validate_alphanum_notnull(value) {
42        return validate_number(value) && validate_notnull(value);
43}
44
45
46function validate_ipadress(value) {
47        return validate_expr(value, "^\\d+\\.\\d+\.\\d+\\.\\d+$");
48}
49
50function validate_ipadress_notnull(value) {
51        return validate_ipadress(value) && validate_notnull(value);
52}
53
54function validate_nameimagefile(value) {
55        return validate_expr(value, "^[0-9a-zA-Z]*$");
56}
57
58
59function validation_highlight(field) {
60        field.focus();
61        field.style.border = "1px solid red";
62        field.style.background = "#fee";
63}
Note: See TracBrowser for help on using the repository browser.