Revision 3491
Added by ben leinfelder over 17 years ago
lib/style/skins/sanparks/SaeonLogin.jspx | ||
---|---|---|
19 | 19 |
|
20 | 20 |
<script language="JavaScript" type="text/JavaScript" src="./searchPathQuery.js"/> |
21 | 21 |
<script type="text/javascript"> |
22 |
|
|
23 |
function allowSubmit(formObj) { |
|
24 |
var result = true; |
|
25 |
var action = ""; |
|
26 |
|
|
27 |
action = trim(formObj.elements["action"].value); |
|
28 |
if (action == "Login") { |
|
29 |
if (isEmpty(formObj.elements["username"])) { |
|
30 |
result = false; |
|
31 |
alert("User name is required"); |
|
32 |
} else if (isEmpty(formObj.elements["organization"])) { |
|
33 |
result = false; |
|
34 |
alert("Organization is required"); |
|
35 |
} else if (isEmpty(formObj.elements["password"])) { |
|
36 |
result = false; |
|
37 |
alert("Password is required"); |
|
38 |
} |
|
39 |
} |
|
40 |
|
|
41 |
return(result); |
|
42 |
} |
|
43 |
|
|
44 |
function isEmpty(aTextField) { |
|
45 |
var value = trim(aTextField.value); |
|
46 |
var result = ((value.length == 0) || (value == null)); |
|
47 |
return(result); |
|
48 |
} |
|
49 |
|
|
50 | 22 |
function trim(stringToTrim) { |
51 | 23 |
return(stringToTrim.replace(/^\s+|\s+$/g,"")); |
52 | 24 |
} |
53 |
</script> |
|
25 |
|
|
26 |
function isEmpty(aTextField) { |
|
27 |
var value = trim(aTextField.value); |
|
28 |
var result = ((value.length == 0) || (value == null)); |
|
29 |
return(result); |
|
30 |
} |
|
31 |
|
|
32 |
function allowSubmit(formObj) { |
|
33 |
var result = true; |
|
34 |
var action = ""; |
|
35 |
|
|
36 |
action = trim(formObj.elements["action"].value); |
|
37 |
if (action == "Login") { |
|
38 |
if (isEmpty(formObj.elements["username"])) { |
|
39 |
result = false; |
|
40 |
alert("User name is required"); |
|
41 |
} else if (isEmpty(formObj.elements["organization"])) { |
|
42 |
result = false; |
|
43 |
alert("Organization is required"); |
|
44 |
} else if (isEmpty(formObj.elements["password"])) { |
|
45 |
result = false; |
|
46 |
alert("Password is required"); |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
return(result); |
|
51 |
} |
|
52 |
</script> |
|
54 | 53 |
|
55 | 54 |
<title>SANParks - South African National Park Data Repository</title> |
56 | 55 |
<link href="sanparks.css" rel="stylesheet" type="text/css" /> |
Also available in: Unified diff
rearrange login validation javascript so that it actually works