-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathSignIn.js
More file actions
51 lines (45 loc) · 1.16 KB
/
SignIn.js
File metadata and controls
51 lines (45 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
document.addEventListener("DOMContentLoaded",function(event){
const changeID = getchangeID();
changeID.focus();
changeID.select();
});
function getchangePword(){
//getter for password
return document.getElementById("password");
}
function getchangeID(){
//getter for ID
return document.getElementById("number");
}
function ValidationEvent(){
// This part deals with invalid inputs for the Employee ID
const changeID = getchangeID();
if(isNaN(Number(changeID.value))){
displayError("Enter a real ID");
changeID.focus();
changeID.select();
return false;
}
else if (Number(changeID.value) <= 0){
displayError("Enter a real ID");
changeID.focus();
changeID.select();
return false;
}
//This part deals with invalid inputs for the Password
const changePword = getchangePword();
if (changePword.value == null){
displayError("Enter real password");
changePword.focus();
changePword.select();
return false;
}
else if (changePword.value.trim() === ""){
displayError("Enter a real password);
changePword.focus();
changePword.select();
return false;
}
// Since this is a validation function, it should return true if valid input
return true;
}