Removed /usr/local from CDPATH
[clearscm.git] / maps / JavaScript / CheckSignup.js
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File:        $RCSFile$
4 // Revision:    $Revision: 1.1 $
5 // Description: This JavaScript is included in the MAPS signup form to check
6 //              the fields of the form.
7 // Author:      Andrew@DeFaria.com
8 // Created:     Fri Nov 29 14:17:21  2002
9 // Modified:    $Date: 2013/06/12 14:05:47 $
10 // Language:    JavaScript
11 //
12 // (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
13 // 
14 ////////////////////////////////////////////////////////////////////////////////
15 function validate (signup) {
16   with (signup) {
17     trim_trailing_spaces (userid);
18
19     if (userid.value == "") {
20       alert ("You must choose a name!");
21       userid.focus ();
22       return false;
23     } // if
24
25     if (userid.value.indexOf (" ") != -1) {
26       alert ("Userids cannot contain spaces");
27       userid.focus ();
28       return false;
29     } // if
30
31     trim_trailing_spaces (fullname);
32
33     if (fullname.value == "") {
34       alert ("Full name is required!");
35       fullname.focus ();
36       return false;
37     } // if
38
39     if (email.value == "") {
40       alert ("We need your email address - in case you forget " +
41              "your password\nand we need to send it to you.");
42       email.focus ();
43       return false;
44     } else {
45       var email_regex = /^\w+@\w+\.\w+$/;
46
47       if (!valid_email_address (email)) {
48         alert ("That email address is invalid!\n"       +
49                "Must be <username>@<domainname>\n"      +
50                "For example: Andrew@DeFaria.com.");
51         return false;
52       } // if
53     } // if
54
55     if (password.value == "") {
56       alert ("You need to specify a password!");
57       password.focus ();
58       return false;
59     } // if
60
61     if (password.value.length < 6) {
62       alert ("Passwords must be greater than 6 characters.");
63       password.focus ();
64       return false;
65     } // if
66
67     if (repeated_password.value == "") {
68       alert ("Please repeat your password.");
69       repeated_password.focus ();
70       return false;
71     } // if
72
73     if (repeated_password.value.length < 6) {
74       alert ("Passwords must be greater than 6 characters.");
75       repeated_password.focus ();
76       return false;
77     } // if
78
79     if (password.value != repeated_password.value) {
80       alert ("Sorry but the password and repeated password are not the same!");
81       password.focus ();
82       return false;
83     } // if
84
85     if (MAPSPOP [0].checked) {
86       alert ("Sorry but MAPSPOP has not be implemented yet!");
87       return false;
88     } // if
89
90     if (tag_and_forward [0].checked) {
91       alert ("Sorry but Tag & Forward has not be implemented yet!");
92       return false;
93     } // if
94   } // with
95    
96   return true;
97 } // validate