-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproject.js
162 lines (145 loc) · 4.37 KB
/
project.js
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
function resetProjectDetails() {
document.getElementById("PName").value = '';
document.getElementById("projectAssigned").value = 'Select';
document.getElementById("SDate").value = '';
document.getElementById("EDate").value = '';
document.querySelector('input[name="priority"]').value = '';
document.getElementById("description").value = '';
let text1 = "Going to the Next Page!\nEither Next or Cancel.";
confirm(text1)
}
function myFunction() {
i=0;
var SchemeName = document.getElementById("SName")
var ScholarshipType = document.getElementById("SType")
var ScholarshipGrade = document.getElementById("SGrade")
var Category = document.getElementById("Category")
var Eligibility = document.getElementById("Eligibility")
var RequiredDoc = document.getElementById("RDoc")
var TimeLimit = document.getElementById("TLimit")
var Scholarship = document.getElementById("Scholarship")
var description = document.getElementById("description")
var email = document.getElementById("Email")
var letters = /^[A-Za-z]+$/;
var error1 = document.getElementById("e1")
var error2 = document.getElementById("e2")
var error3 = document.getElementById("e3")
var error4 = document.getElementById("e4")
var error5 = document.getElementById("e5")
var error6 = document.getElementById("e6")
var error7 = document.getElementById("e7")
var error8 = document.getElementById("e8")
var error9 = document.getElementById("e9")
var error10 = document.getElementById("e10")
var Email= /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
if(SchemeName.value.match(letters) && SchemeName.value!="")
{
error1.textContent = ""
i+=1
}
else
{
error1.textContent = "Please enter a valid SchemeName(no numaric)"
error1.style.color = "red"
}
if(ScholarshipType.value.match(letters) && ScholarshipType.value!="")
{
error2.textContent = ""
i+=1
}
else
{
error2.textContent = "Please enter a valid ScholarshipType"
error2.style.color = "red"
}
if(ScholarshipGrade.value.match(letters) && ScholarshipGrade.value!="")
{
error3.textContent = ""
i+=1
}
else
{
error3.textContent = "Please enter a valid ScholarshipGrade"
error3.style.color = "red"
}
if( Scholarship.value!="")
{
error4.textContent = ""
i+=1
}
else
{
error4.textContent = "Please enter a valid Year of Scholarship"
error4.style.color = "red"
}
if(Category.value.match(letters) && Category.value!="")
{
error5.textContent = ""
i+=1
}
else
{
error5.textContent = "Please enter a valid Category"
error5.style.color = "red"
}
if(Eligibility.value.match(letters) && Eligibility.value!="")
{
error6.textContent = ""
i+=1
}
else
{
error6.textContent = "Please enter a valid Eligibility"
error6.style.color = "red"
}
if(RequiredDoc.value.match(letters) && RequiredDoc.value!="")
{
error7.textContent = ""
i+=1
}
else
{
error7.textContent = "Please enter a valid RequiredDoc"
error7.style.color = "red"
}
TimeLimit
if(TimeLimit.value!="")
{
error8.textContent = ""
i+=1
}
else
{
error8.textContent = "Please enter a valid TimeLimit"
error8.style.color = "red"
}
if(description.value!="")
{
error9.textContent = ""
i+=1
}
else
{
error9.textContent = "Description cant be empty"
error9.style.color = "red"
}
if(email.value!="" && email.value.match(Email))
{
error10.textContent = ""
i+=1
}
else
{
error10.textContent = "Please check these field"
error10.style.color = "red"
}
let text = "Going to the Next Page!\nEither Next or Cancel.";
if(i==10){
if (confirm(text) == true) {
window.location.assign("index/index.html");
}
}else{
var myText = "Fill the form correctly";
alert (myText);
}
}