Link to home
Start Free TrialLog in
Avatar of cano63
cano63

asked on

Javascript validation

Hello,

I'm trying to make a logic for a validation.  

This is my scenario.

I have a screen that have two Lines,

Record 1 and Record 2
each record have 6 days and 6 hours.

The hours are from 7:00 AM to 6:00 PM and the days are from 1 to 31.

The hours values go from fifteen to fifteen .
7:00 AM, 7:15 AM, 7:30 AM, 7:45 AM, 8:00 AM. (this wil be in a drop down
I have this condition groups 30 minutes can have a max of 2 day selected and a group of 45 minutes can have a max of 4 day selected.

I have to verify that if  group start at  11:00 on day one it can only have 2 records selected, but if it have more than 2 and a max of 4, the next group of the same day have to start at 11:45, not before, if the group was just from 2 then the next group day will be of 11:30.

I was trying to use a for next, but I'm not really sure if that is the way to do it.

Record1:
Day1 Hour1,  Day2 Hour2,  Day3 Hour3,  Day4 Hour4,  Day5 Hour5,  Day6 Hour6,  

Record2:
Day1 Hour1,  Day2 Hour2,  Day3 Hour3,  Day4 Hour4,  Day5 Hour5,  Day6 Hour6,  

This have to be in java script because are just with the records on the screen
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

1. I added the JavaScript zone to your question
2. Can you post your html, since your question does not make much sense
Not quite.

You did not post enough information for us to help you and the information you DID post was not clearly understandable without code or diagrams
Avatar of cano63
cano63

ASKER

I don,t have a diagram, but this is the problem.

Here is the problem:

I have a screen that will have the following values

Record1:
Day1 Hour1,  Day2 Hour2,  Day3 Hour3,  Day4 Hour4,  Day5 Hour5,  Day6 Hour6,  

Record2:
Day1 Hour1,  Day2 Hour2,  Day3 Hour3,  Day4 Hour4,  Day5 Hour5,  Day6 Hour6,  

each record will have 12 drop downs, This will be in pair of 2 , the Days drop down will have days from 1 -31 and the drop down of hours will have time from 7:00 AM to 6:45 PM divided in sequence of 15 minutes, 7:00 AM - 7:15:00 AM - 7:30 AM, like that.

Each record have one student, and one student can be occupied on a specific day at specific time.

If the student work alone he can just work 30 minutes, and if the student work on group he will be able to work with a maximums of 4 students and just 45 minutes.

My rule have to verify that this student don't, be working the same day and the same time in other of the records and that he don't pass the amount of 30 minutes alone and 45 minutes with a max of 4 users.


Is this homework?

If so can you please post the html that goes with the tests so I do not have to write it  - it will help me find out where to put the tests
Avatar of cano63

ASKER

No, is not for homework, is for a production application tha will be running in a center of services.

Ok I would stil like to have a start
Because no code from the asker... I love to HELP people, not write all their code for free...
Avatar of cano63

ASKER

Let me know is this help, this is the html of the jsp

This will be 13 records, i,m just copying 2
<table border="0" class="tablewidth4">
							<tbody>
								<tr>
									<td align="center" width="49"><span class="labelsBold">Record:</span></td>
									<td width="117">
									<table>
										<tbody>
											<tr>
												<td width="115" align="center"><span class="labelsBold">Number</span></td>
											</tr>
										</tbody>
									</table>									</td>
									<td width="116" align="center"><span class="labelsBold">Name</span></td>
									<td width="57" align="center"><span class="labelsBold">Age</span></td>
									<td width="107" align="center"><span class="labelsBold">Place</span></td>
									<td width="114" align="center">Town</td>
									<td align="center" width="122"><span class="labelsBold">Entity</span></td>
									<td align="center" width="138"><table border="0">
										<tbody valign="top">
											<tr valign="top">
												<td id="Terapia1" align="center" width="51"><span
													class="labelsBold">Therapy</span></td>
												<td id="Evaluacion1" align="center" width="52"><span class="labelsBold">Therapy</span></td>
											</tr>
											<tr valign="top">
											  <td id="Terapia3" align="center">&nbsp;</td>
											  <td id="Evaluacion3" align="center">&nbsp;</td>
										  </tr>
										</tbody>
									</table>									</td>
									<td align="center" width="86"><table
										border="0">
										<tbody>
											<tr>
												<td id="Lugar1" ><span class="labelsBold">Place:</span></td>
											</tr>
										</tbody>
									</table>									</td>
									<td width="12"><span class="labelsBold"></span></td>
								</tr>
								<tr>
									<td align="center" width="49"><span class="labelsBold">1:</span></td>
									<td align="center" width="117"><input type="text" name="txtNumber1" size="20" class="inputField" onchange="search('1')"></td>
									<td width="116" align="center"><input type="text" name="txtEst1" size="20" class="inputField2" readonly></td>
									<td width="57" align="center"><input type="text" name="txtedad1" size="20" class="inputField8" readonly></td>
									<td width="107" align="center"><input type="text" name="txtEsc1" size="20" class="inputField" readonly></td>
									<td width="114" align="center"><input type="text" name="txtDis1" size="20" readonly class="inputField"></td>
									<td align="center" width="122"><input type="text" name="txtPu1" size="20" readonly class="inputField"></td>
									<td align="center" width="138"><select name="dpTip1" id="dpTip1" class="inputField13" onchange="place(1)">
									<option></option>

									</select> </td>
									<td align="center" width="86"><input type="text" name="txtCen1" size="20" class="inputField14" readonly></td>
									<td align="center" width="12">										 </td>
								</tr>
								<tr>
									<td align="center" width="49">
									<table border="0">
										<tbody>
											<tr>
												<td align="center"><span class="labelsBold"></span></td>
											</tr>
											<tr>
												<td align="center">													</td>
											</tr>
										</tbody>
									</table>									</td>
									<td colspan="9">
									<table border="0">
										<tbody>
											<tr>
												<td><span class="labelsBold">Day-1:</span></td>
												<td><span class="labelsBold">Time1:</span></td>
												<td><span class="labelsBold">Day-2:</span></td>
												<td><span class="labelsBold">Time2:</span></td>
												<td><span class="labelsBold">Day-3:</span></td>
												<td><span class="labelsBold">Time3:</span></td>
												<td><span class="labelsBold">Day-4:</span></td>
												<td><span class="labelsBold">Time4:</span></td>
												<td><span class="labelsBold">Day-5:</span></td>
												<td><span class="labelsBold">Time5:</span></td>
												<td><span class="labelsBold">Day-6:</span></td>
												<td><span class="labelsBold">Time6:</span></td>
											</tr>
											<tr>
												<td><select name="dpDia1_1">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora1_1">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia1_2">
													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora1_2">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia1_3">
													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora1_3">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia1_4">
													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora1_4">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia1_5">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>

												</select></td>
												<td><select name="dpHora1_5">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia1_6">
													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora1_6">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
											</tr>
										</tbody>
									</table>									</td>
								</tr>
								<tr>
									<td colspan="10">
									<hr>									</td>
								</tr>
								<tr>
									<td align="center" width="49"><span class="labelsBold">Record:</span></td>
									<td align="center" width="117"><span class="labelsBold">Number</span></td>
									<td width="116" align="center"><span class="labelsBold">Name:</span></td>
									<td width="57" align="center"><span class="labelsBold">Age</span></td>
									<td width="107" align="center"><span class="labelsBold">Place:</span></td>
									<td width="114" align="center"><span class="labelsBold">Town:</span></td>
									<td align="center" width="122"><span class="labelsBold">Entity</span></td>
									<td align="center" width="138"><table border="0">
										<tbody valign="top">
											<tr valign="top">
												<td id="Terapia2" align="center" width="51"><span class="labelsBold">Therapy</span></td>
												<td id="Evaluacion2" align="center" width="52"><span class="labelsBold">Therapy</span></td>
											</tr>
										</tbody>
									</table>									</td>
									<td align="center" width="86"><table border="0">
										<tbody>
											<tr>
												<td id="Lugar2"><span class="labelsBold">Place:</span></td>
											</tr>
										</tbody>
									</table>									</td>
									<td width="12"></td>
								</tr>
								<tr>
									<td align="center" width="49"><span class="labelsBold">2:</span></td>
									<td align="center" width="117"><input type="text" name="txtNumber2" size="20" class="inputField" onchange="search('2')"></td>
									<td width="116" align="center"><input type="text" name="txtEst2" size="20" class="inputField2" readonly></td>
									<td width="57" align="center"><input type="text" name="txtedad2" size="20" class="inputField8" readonly></td>
									<td width="107" align="center"><input type="text" name="txtEsc2" size="20" class="inputField" readonly></td>
									<td width="114" align="center"><input type="text" name="txtDis2" size="20" readonly class="inputField"></td>
									<td align="center" width="122"><input type="text" name="txtPu2" size="20" readonly class="inputField"></td>
									<td align="center" width="138"><select name="dpTip2" id="dpTip2" onchange="place(2)" class="inputField13">

										<option></option>
									</select></td>
									<td align="center" width="86"><input type="text" name="txtCen2" size="20" class="inputField14" readonly></td>
									<td align="center" width="12"></td>
								</tr>
								<tr>
									<td align="center" width="49">
									<table border="0">
										<tbody>
											<tr>
												<td align="center"></td>
											</tr>
											<tr>
												<td align="center"></td>
											</tr>
										</tbody>
									</table>									</td>
									<td colspan="9">
									<table border="0">
										<tbody>
											<tr>
												<td><span class="labelsBold">Day-1:</span></td>
												<td><span class="labelsBold">Time1:</span></td>
												<td><span class="labelsBold">Day-2:</span></td>
												<td><span class="labelsBold">Time2:</span></td>
												<td><span class="labelsBold">Day-3:</span></td>
												<td><span class="labelsBold">Time3:</span></td>
												<td><span class="labelsBold">Day-4:</span></td>
												<td><span class="labelsBold">Time4:</span></td>
												<td><span class="labelsBold">Day-5:</span></td>
												<td><span class="labelsBold">Time5:</span></td>
												<td><span class="labelsBold">Day-6:</span></td>
												<td><span class="labelsBold">Time6:</span></td>
											</tr>
											<tr>
												<td><select name="dpDia2_1">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora2_1">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia2_2">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora2_2">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia2_3">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora2_3">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia2_4">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora2_4">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia2_5">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora2_5">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpDia2_6">

													<c:forEach var="item" items="${Dias.dias}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
												<td><select name="dpHora2_6">
													<c:forEach var="item" items="${Horas.horas}">
														<option value="${item}">${item}</option>
													</c:forEach>
												</select></td>
											</tr>
										</tbody>
									</table>									</td>
								</tr>
								<tr>
									<td colspan="10">
									<hr>									</td>
								</tr>
							</tbody>
						</table>

Open in new window

Great. I'll look tomorrow (in about 10 hours) bedtime here
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial