| 98 | | function validatecode() |
| 99 | | { |
| 100 | | var code = document.getElementById("VclassmemberCode").value; |
| 101 | | |
| 102 | | var invi = document.getElementById("hinvi").value; |
| 103 | | |
| 104 | | //alert(code + invi); |
| 105 | | |
| 106 | | if (invi == 1) |
| 107 | | { |
| 108 | | if ( !code || code == '' ) |
| 109 | | { |
| 110 | | alert("You must type the code"); |
| 111 | | return false; |
| 112 | | } |
| 113 | | } |
| 114 | | return true; |
| 115 | | } |
| 116 | | |
| 117 | | function validateUser() { |
| 118 | | |
| 119 | | var group = document.getElementById('UserGroupId'); |
| 120 | | var code = document.getElementById('UserCode'); |
| 121 | | var username = document.getElementById('UserUsername'); |
| 122 | | var name = document.getElementById('UserName'); |
| 123 | | var passwd = document.getElementById('UserPasswd'); |
| 124 | | var email = document.getElementById('UserEmail'); |
| 125 | | |
| 126 | | if (username.value.length < 6) |
| 127 | | { |
| 128 | | alert("Login must have at least six characters"); |
| 129 | | username.focus(); |
| 130 | | return false; |
| 131 | | } |
| 132 | | |
| 133 | | if (name.value.length < 6) |
| 134 | | { |
| 135 | | alert("Type your name and last name"); |
| 136 | | name.focus(); |
| 137 | | return false; |
| 138 | | } |
| 139 | | |
| 140 | | |
| 141 | | if (email.value.length < 3) |
| 142 | | { |
| 143 | | alert("You must type an email"); |
| 144 | | email.focus(); |
| 145 | | return false; |
| 146 | | } |
| 147 | | |
| 148 | | var check = validate_email(email.value); |
| 149 | | |
| 150 | | if (check == false) |
| 151 | | { |
| 152 | | alert("Email is not valid"); |
| 153 | | passwd.focus(); |
| 154 | | return false; |
| 155 | | } |
| 156 | | |
| 157 | | if (passwd.value.length < 6) |
| 158 | | { |
| 159 | | alert("Password must have at least six characters"); |
| 160 | | passwd.focus(); |
| 161 | | return false; |
| 162 | | } |
| 163 | | |
| 164 | | //alert(code + invi); |
| 165 | | |
| 166 | | if (group.value == 5) |
| 167 | | { |
| 168 | | if ( !code || code.value.length < 4 ) |
| 169 | | { |
| 170 | | alert("You must type the code"); |
| 171 | | code.focus(); |
| 172 | | return false; |
| 173 | | } |
| 174 | | } |
| 175 | | return true; |
| 176 | | } |
| 177 | | |
| 178 | | function validate_email(email) { |
| 179 | | |
| 180 | | with (email) |
| 181 | | { |
| 182 | | var apos = email.indexOf("@"); |
| 183 | | var dotpos = email.lastIndexOf("."); |
| 184 | | |
| 185 | | if (apos < 1|| dotpos-apos < 2) |
| 186 | | { |
| 187 | | return false; |
| 188 | | } else { |
| 189 | | return true; |
| 190 | | } |
| 191 | | } |
| 192 | | } |
| 193 | | |
| 194 | | function validateEntry() { |
| 195 | | |
| 196 | | var EntryTitle = document.getElementById("EntryTitle"); |
| 197 | | |
| 198 | | var EntryBody = document.getElementById("EntryBody"); |
| 199 | | |
| 200 | | if (EntryTitle.value.length < 1) |
| 201 | | { |
| 202 | | alert("You must type a title"); |
| 203 | | return false; |
| 204 | | } |
| 205 | | |
| 206 | | if (EntryBody.value.length < 3) |
| 207 | | { |
| 208 | | alert("You must type the entry's body"); |
| 209 | | return false; |
| 210 | | } |
| 211 | | return true; |
| 212 | | } |
| 213 | | |