-
Notifications
You must be signed in to change notification settings - Fork 0
/
QuestionDisplay.jsp
304 lines (213 loc) · 7.64 KB
/
QuestionDisplay.jsp
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<%@ page import="java.sql.*" %>
<%@ page import="csatdisplay.*"%>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="styles.css">
<script>
function validateForm() {
var iPN = document.forms["questions"]["inputProject"].value;
var iPMN = document.forms["questions"]["inputProjectManager"].value;
var iCM= document.forms["questions"]["inputCustomerManager"].value;
var x=document.getElementsByTagName("input");
var f=1;
for( var i=3; i<x.length; i=i+5)
{
var quest= x[i].name;
var radios = document.getElementsByName(quest);
var ischecked_method = false;
for ( var j = 0; j < radios.length; j++) {
if(radios[j].checked) {
ischecked_method = true;
break;
}
}
if(!ischecked_method) { //radio button is not checked
alert("Please choose a rating for "+quest);
f=0;
}
}
if ((iPN == null || iPN == "") || (iPMN == null || iPMN == "")|| (iCM == null || iCM == "")) {
alert("Please check if ProjectName Sonata ProjectManager name and CustomerName are filled");
return false;
}
if(f==0)
{
alert("all fields are mandatory fill");
return false;
}
}
function ClearForm(){
document.logingForm.reset();
document.logingForm.uname.value="";
}
</script>
<style>
table, th, td {
border: 1px solid black;
padding: 3px;
}
th,td
{
padding: 4px;
}
</style>
<title>Insert title here</title>
</head>
<body onload="ClearForm();">
<%
ArrayList<CsatQuest> qList=new ArrayList<CsatQuest>();
qList=(ArrayList<CsatQuest>)request.getAttribute("QuestionsList");
HttpSession session=request.getSession(false);
String uname=(String)session.getAttribute("username");
%>
<div id='cssmenu'>
<ul>
<li class="active"><a href="http://localhost:8081/Test/displayQuestions" ><span>CsatForm</span></a></li>
</ul>
</div>
<br>
<br>
<br>
<br>
<!-- <div class="container"> -->
<form name="questions" class="form-horizontal" action="insert" onsubmit="return validateForm()">
<div class="container">
<div class="row">
<br>
<br>
<div class="col-lg-6">
<div class="well well-sm"><strong><span class="glyphicon glyphicon-asterisk"></span>Required Field</strong></div>
<br>
<br>
<br>
<div class="form-group">
<label for="InputName">Project/Application/Customer</label>
<div class="input-group">
<input type="text" class="form-control" name="inputProject" id="InputName" >
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
<div class="form-group">
<label for="InputManager">Sonata Project Manager</label>
<div class="input-group">
<input type="text" class="form-control" name="inputProjectManager" id="InputName" >
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
<div class="form-group">
<label for="InputCustomerManager">Customer Manager</label>
<div class="input-group">
<input type="text" class="form-control" name="inputCustomerManager" id="InputName" value=<%= uname %>>
<span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="table-responsive">
<table style="border: 1px solid black">
<thead>
<tr style="background-color: #C6E8FF">
<th class="col-sm-5"><center>Parameters</center></th>
<th class="col-sm-3"><center>Rating</center></th>
<th class="col-sm-4"><center>Comments</center></th>
</tr>
</thead>
<!-- <tr style="background-color: #F2F2F2">
<th ><br><center>PerformanceParameters<br><br></center></th>
<th>5- Excellent 4- Good 3- Satisfactory 4- Somewhat Satisfactory 5-Not Satisfactory</th>
<th></th>
</tr> -->
<%
Iterator<CsatQuest> it= qList.iterator();
/* String[] qnos= ob.getQuestionNos();
String[] questions=ob.getQuestions(); */
char temp=' ';
char qType;
int i=0; int cmt=1;
while(it.hasNext())
{
CsatQuest ob = it.next();
qType=ob.getQuestionType();
if(!(temp==qType))
{
%>
<tr style="background-color: #F2F2F2">
<%
switch(qType)
{
case 'p' : %>
<th ><br><center>PerformanceParameters<br><br></center></th>
<% break;
case 't' : %>
<th ><br><center>Team<br><br></center></th>
<% break;
case 'o' : %>
<th ><br><center>OverAll<br><br></center></th>
<% break;
}
%>
<th><br>5- Excellent 4- Good 3- Satisfactory 4- Somewhat Satisfactory 5-Not Satisfactory<br></th>
<th> </th>
</tr>
<%
}
temp=qType;
%>
<tr >
<td style="border: 1px solid black">
<label class="col-md-8 control-label" for="radios1">
<% out.print(ob.getQuestions());
String q=ob.getQuestionNos();
/* i++; */
%>
</label>
</td>
<td>
<div class="radio-inline">
<label><input type="radio" name=<%= q %> value=1>1</label>
</div>
<div class="radio-inline">
<label><input type="radio" name=<%= q %> value=2>2</label>
</div>
<div class="radio-inline">
<label><input type="radio" name=<%= q %> value=3>3</label>
</div>
<div class="radio-inline">
<label><input type="radio" name=<%= q %> value=4>4</label>
</div>
<div class="radio-inline">
<label><input type="radio" name=<%= q %> value=5>5</label>
</div>
</td>
<td>
<textarea class="form-control" name=<%= q+""+q %>></textarea>
</td>
</tr>
<%
}
%>
</table>
</div>
<br>
<br>
<br>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<center><br><br><br><button type="submit" class="btn btn-primary">Submit</button>
</center>
</div>
</div>
</form>
</body>
</html>