List of checkboxes

List of checkboxes

Hi!

I appreciate your effort for giving the response but now it displays only the last value of ArrayList. In other words, it is now displaying just the last time slot. Also, without clicking the checkbox that single time slot gets deleted.

I'm resending the modified code=

<center>
<table border="0" width="100%" height="100%" background="images/img1.jpg" style="background-repeat:repeat-x, repeat-y; background-position:top">
<tr>
<td width="10%" height="100%">&nbsp;</td>
<td width="80%" height="100%">
<table border="0" width="100%" height="100%">
<tr>
<td>
<table border="0" width="100%" height="100%" background="images/header-fill1.jpg" cellspacing="0">
<form action="" name="SchMeetForm">
<tr>
<th colspan="4">
<u>Schedule a Meeting</u>
</th>
<th align="right">
<input type="submit" value="Send" class="but">
</th>
</tr>
<tr align="left">
<td>
Subject:
</td>
<td>
<input type="text" name="subject">
</td>
<td>
&nbsp;
</td>
<td>
Where:
</td>
<td>
<select>
<%
MsdsConnection msdsconn;
Statement stmt=null;
ResultSet rs=null;
msdsconn=new MsdsConnection();
msdsconn.initialize(getServletContext());
msdsconn.establishConn();
Connection conn=msdsconn.getMsdsConnection();
stmt=conn.createStatement();
rs = stmt.executeQuery("select loc_name from location");
while(rs.next())
{
%>
<option> <%=rs.getString(1)%> </option>
<% } %>
</select>
</td>
</tr>
<tr align="left">
<td>
Date:
</td>
<td>
<script>DateInput('orderdate', true, 'DD-MON-YYYY')</script>
<!--<input type="button" onClick="alert(this.form.orderdate.value)" value="Show date value passed">-->
</td>
<td>
&nbsp;
</td>
<td>
Chair:
</td>
<td>
<select>
<%
rs = stmt.executeQuery("select emp_name from employee");
while(rs.next())
{
%>
<option> <%=rs.getString(1)%> </option>
<% } %>
%>
</select>
</td>
</tr>
</form>
<form action="#" name="TSForm">
<tr align="left">
<td>
When &nbsp;&nbsp;
Starts:
</td>
<td>
<input type="text" name="startsHr" size="1" maxlength="2" OnKeyPress="return validateNumeric()"/>:
<input type="text" name="startsMin" size="1" maxlength="2" OnKeyPress="return validateNumeric()"> &nbsp; [24HH:MM]
</td>
</tr>
<tr align="left">
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Ends:
</td>
<td>
<input type="text" name="endsHr" size="1" maxlength="2" OnKeyPress="return validateNumeric()">:
<input type="text" name="endsMin" size="1" maxlength="2" OnKeyPress="return validateNumeric()"> &nbsp; [24HH:MM] &nbsp;

<input type="submit" name="save" value="Save" class="but" >
</td>
</tr>
</form>
</table>
</td>
</tr>
<%
String btn=request.getParameter("save");
if(btn!=null)
{
%>
<tr>
<td>
<table bgcolor="#F8F8FF" cellspacing="0" border="0" border="0" width="100%" height="100%">
<tr align="center">
<th align="left">
<u> Initiated Time Slots: </u>
</th>
</tr>
<tr align="left">
<td>
<%
String sh=request.getParameter("startsHr");
String sm=request.getParameter("startsMin");
String eh=request.getParameter("endsHr");
String em=request.getParameter("endsMin");
int index=0;

ArrayList al=new ArrayList();
if(sh!=""&&sm!=""&&eh!=""&&em!="")
{
int nsh=Integer.parseInt(sh);
int nsm=Integer.parseInt(sm);
int neh=Integer.parseInt(eh);
int nem=Integer.parseInt(em);

if(nsh<0 || nsh>23 || nsm<0 || nsm>60 || neh<0 || neh>23 || nem<0 || nem>60)
{ %>
Invalid Time!

<% }
else
{

al.add(index);
al.add(sh);
al.add(sm);
al.add(eh);
al.add(em);
index++;
Iterator itr = al.iterator();
while(itr.hasNext())
{
%>
<input type="checkbox" name="ts" id="ts" value="<%=itr.next()%>">
<label id="div"><%=itr.next()%>:<%=itr.next()%>&nbsp;-&nbsp;<%=itr.next()%>:<%=itr.next()%></label>
<br>
<%
}
}

String d=request.getParameter("delete");
if(d!=null)
{
String[] p;
p=request.getParameterValues("ts");
//System.out.println(p);
if(p!=null)
{
for (int i = 0; i < p.length; i++)
{
int j;
for(j=0;j<al.size();j++)
{
if(al.get(j)==p[i])
break;
}
for(int k=0;k<5;k++)
{
al.remove(j);
}
}
}
}
} %>
</td>
</tr>
<tr align="left">
<td>
<input type="button" value="Remove" onclick="del();" class="but" name="delete">
</td>
</tr>
</tr>
</table>
</td>
</tr>
<% } %>
</table>
</td>
<td width="10%" height="100%">&nbsp;</td>
</tr>
</table>
</center>

<script>
function del(){

if (document.getElementById) {
document.getElementById('ts').style.visibility = 'hidden';
document.getElementById('div').style.visibility = 'hidden';
}
}
</script>
View Answers









Related Tutorials/Questions & Answers:
List of checkboxes - JSP-Servlet
List of checkboxes  Hi! I making a list of time-slots with a checkbox against every such time-slot in a JSP page. My requirement is that when one or more checkboxes are checked and the delete button is clicked
List of checkboxes - JSP-Servlet
List of checkboxes  Hi! I appreciate your effort for giving the response but now it displays only the last value of ArrayList. In other words, it is now displaying just the last time slot. Also, without clicking the checkbox
Advertisements
The checkboxes tag
In this section, you will learn about checkboxes tag of Spring form tag library
checkboxes set to true using JavaScript
checkboxes set to true using JavaScript  To set all checkboxes to true using JavaScript
Array of checkboxes - Struts
Array of checkboxes  How to handle unknown number of checkboxes using tag in an ActionForm.   Hi friend, Code for multiple checkbox import javax.servlet.http.HttpServletRequest; import
Updating multiple value depending on checkboxes
Updating multiple value depending on checkboxes  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST
Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST  I have a table... checkboxes should be displayed. And we should keep remaining checkboxes
help me in disabling checked checkboxes
modification in this code....such that... when i select some checkboxes... remaining checkboxes as enabled. ADS_TO_REPLACE_2 I have stuck this problem from last
Retriving multiple values of checkboxes in struts
Retriving multiple values of checkboxes in struts  how to retrive multiple values of checkboxes of jsp in action class   JSP Retrieve checkbox values 1)checkbox.jsp: <html> <body> <form method="post
Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2
Maintaining States of Selected CheckBoxes in Different Pages using dispaly... i am showing the list using a displaytag.Each row in the list has a checkbox. Actually my requirement is to select particular checkboxes across different pages
how to get data from checkboxes - JSP-Servlet
how to get data from checkboxes  hi, i got list of tables on screen by invoking webservices.when the user selects the tables by using checkboxes, i need to get only those tables to the next page where i can get list of columns
how to display selected checkboxes dynamically using jsp
how to display selected checkboxes dynamically using jsp  Hi friends i have a requirement that : in my JSP page i have radio buttons followed by the DB fields..when i click SUBMIT button,if the field(or record
dropdown wth checkboxes - Design concepts & design patterns
dropdown wth checkboxes  Hi Friends, Instead of using Ctrl key i want to put checkboxes inside the dropdown,then we can check the options whatever we want. Please give me the html code(only html & javascript). Thanks
JavaScript Array of checkboxes
JavaScript Array of checkboxes       In this Tutorial we want to describe you a code that help you in understanding JavaScript Array of checkboxes. For this we
Remove checked checkboxes from arraylist and dipaly remaining arraylist
Remove checked checkboxes from arraylist and dipaly remaining arraylist  I want to delete checked checkboxes after submitting button. And i want... elements). For , this problem i tried to get all checked checkboxes names in string
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to add a column with checkboxes for each record in my table in JSP
How to add a column with checkboxes for each record in my table in JSP   Hi, Could you please explain it to me how I can add a column with check boxes for each record in my table in JSP? Also, I want to figure out a way
List
List  i do have one list object, i want to compare this list from database table and if match found i want to update the list
List
List  getting values from a form and make a list of them and store them into database
want to ask how to update data for runtime selected multiple checkboxes
have checkboxes for each record when I will select more than one checkboxex...;H3>LIST OF CUSTOMERS-ADDRESS TO BE CONFIRMED</H3> <input type
how to update combobx's selected value to database with respect toselected multiple checkboxes
how to update combobx's selected value to database with respect toselected multiple checkboxes   suppose this if form1.jsp in which i am going to display records from database out.println("<tr><td>"+"<input type
After changing url params d req checkboxes are not showing as clicked in jsf programming - Java Server Faces Questions
After changing url params d req checkboxes are not showing as clicked in jsf... richfaces) There is having a list of artist . If u click on a particular artistname then the respective albums(with their checkboxes) will show up like
required treenodes checkboxes are not clicking if u change the url - Java Server Faces Questions
required treenodes checkboxes are not clicking if u change the url  Hi, Here i have Library.java file. just look at d url : http://localhost...) { this.state2 = state2; } public void walk(TreeNode node, List appendTo
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement - Java Beginners
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement  Dear Experts, Tried as I might looking for solutions to resolve my Servlet problem, I still can't resolve it. Hope that you can share
Delete multiple records with pagination by selecting checkboxes
List interface
List interface  What is the List interface
list boxs
list boxs  i have two list boxes first list box values from database and i want to assign selected options to the second list box using jsp is it possible to do this in jsp
linked list
linked list  program for single linked list
Linked list
Linked list  what is difference btw linked list in datastructure and linked list in java
List interface
List interface  Give me some of the real time examples that can be developed based on List and its implemented classes
Java list
Java list  What is the difference between a Choice and a List
List of mobiles
List of mobiles  which mobile phones support j2me
linked list
linked list  Hi i have a problem with linked list ! how and where i can use linked list? please give me some example.   Please visit...://www.roseindia.net/java/beginners/linked-list-demo.shtml
linked list
linked list   how to add student and mark and number from file in linked list and print them also how to make search function plz can help me sooon
linked list
linked list  hi i have basal problem what is the linked list
linked list
linked list   how to write a program using a linked list...); System.out.println("Add elements to LinkedList: "); LinkedList<String> list=new...); } Collections.reverse(list); System.out.println("List of names in reverse order
list and textbox
list and textbox  sir, i want to create a search, where when i type the letters, the words starting with that letters are to be searched and displayed. Also like a list i should navigate and select the appropriate word which
ModuleNotFoundError: No module named 'list-in-list'
ModuleNotFoundError: No module named 'list-in-list'  Hi, My Python... 'list-in-list' How to remove the ModuleNotFoundError: No module named 'list-in-list' error? Thanks   Hi, In your python
Linked List
in the following logical linked list represents Computer Number. 76(head) 98 54...? to ?66?. The segment should also display the new contents of the linked list. ii. Write a program segment to copy all ?Dell? computers to a new linked list
linked list
program to manage the registration details for the institute. 1. Use a linked list to manage the details of all registered students. a. Create your own linked list
Array List
Array List   Complete the class House and HouseApp below to display class House{ int lotNo; String type; //Bungalow, SemiDetached double price; public House ( int l, String t, double p) { ââ?¬Â¦ } public int theLotN() { Ã
DropDown list
DropDown list  how to get mysql database values into dropdown usign java servlet and ajax?   Here is a jsp code that displays the database values into dropdown list. 1)country.jsp: <%@page import="java.sql.*"%>
List In Java
List In Java In this section we will read about the List data structure in Java and how the List data structure can be implemented in Java. List data structure is implemented in Java using List interface. List interface allows
pdf list
pdf list       In this program we are going to know how we can make a list in a pdf file irrespective... the document by document.open(). Create a numbered List with 30 point field
List in J2ME
List in J2ME       Exclusive List MIDlet Example This example illustrates how to create a Exclusive List. The Exclusive List is used to select only one list element at a time
List in J2ME
List in J2ME       J2ME Canvas List Example will explain you, how to create list of items. In this example we are going to create a simple list of text, that will show
Merge two list into a single list
list. Here you find mainly three function. The insertnode function makes node... and the mergelist funtion merge the two lists into a single list. Code: # include... ( struct node *p ) { printf("The data values in the list are\n"
ModuleNotFoundError: No module named 'list-within-list'
ModuleNotFoundError: No module named 'list-within-list'  Hi, My... named 'list-within-list' How to remove the ModuleNotFoundError: No module named 'list-within-list' error? Thanks   Hi, In your

Ads