-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.js
More file actions
36 lines (34 loc) · 1.01 KB
/
validation.js
File metadata and controls
36 lines (34 loc) · 1.01 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
function validate() //registration
{
var username=document.getElementById("username").value;
var password=document.getElementById("password").value;
var email=document.getElementById("email").value;
if (username != '' && password != '' && email != ''){
if(username.length >=6 && password.length >=6){
return true;
}
else{
alert("<h6 id='red'>Username and/or Password too short!</h6>");
return false;
}
}
else{
alert("All fields are required!");
return false;
}
}
function validate_books() //upload books
{
var title=document.getElementById("title").value;
var author=document.getElementById("author").value;
var description=document.getElementById("description").value;
var genre=document.getElementById("genre").value;
var pdf_file=document.getElementById("pdf_file").value;
if(title != '' && author != '' && description != '' && genre != '' && pdf_file != ''){
return true;
}
else {
alert("<h6 id='red'>All fields are required!</h6>");
return false;
}
}