I have a JSP page that dynamically lists records in a table from my database. At the left hand side of each row in the table, there are checkboxes for the user to select a particular record that he/she wants to do manipulation. Here we are showing 100 records per page and user can go to next page in which it will show one more hundred records(ie 101 to 200)..As now the problem is when user has select the particular record in Page 1 and when go to Page 2 and if he come back to page 1 the selected paritcular is not checked.... how make it to selected...
Problem with selecting Check box in a jsp
Collapse
X
-
Tags: None
-
keep an array of selected checkbox ids, and other info if needed in the session. whenever you go to any page check for the checkbox id, if exists then check it else let it be unchecked.Originally posted by chindanoorI have a JSP page that dynamically lists records in a table from my database. At the left hand side of each row in the table, there are checkboxes for the user to select a particular record that he/she wants to do manipulation. Here we are showing 100 records per page and user can go to next page in which it will show one more hundred records(ie 101 to 200)..As now the problem is when user has select the particular record in Page 1 and when go to Page 2 and if he come back to page 1 the selected paritcular is not checked.... how make it to selected... -
Originally posted by chindanoorI have a JSP page that dynamically lists records in a table from my database. At the left hand side of each row in the table, there are checkboxes for the user to select a particular record that he/she wants to do manipulation. Here we are showing 100 records per page and user can go to next page in which it will show one more hundred records(ie 101 to 200)..As now the problem is when user has select the particular record in Page 1 and when go to Page 2 and if he come back to page 1 the selected paritcular is not checked.... how make it to selected...
Hi,
You can do one thing also. Whnever you move from one page to another put ids of the selected checkboxes in a temp table and then everytime fetch the ids at every page to make checkboxes checked.
After finishing this operation delete data from that table.
Regards,Comment
-
Hi,Originally posted by chindanoorI have a JSP page that dynamically lists records in a table from my database. At the left hand side of each row in the table, there are checkboxes for the user to select a particular record that he/she wants to do manipulation. Here we are showing 100 records per page and user can go to next page in which it will show one more hundred records(ie 101 to 200)..As now the problem is when user has select the particular record in Page 1 and when go to Page 2 and if he come back to page 1 the selected paritcular is not checked.... how make it to selected...
I have a JSP page same as yours.
I can select the checkbox but I can't get the values...
I want to select the checkbox and it gives me value of data.
all things must be dynamically.
please helppp me :(Comment
-
Can you be more specific about your problem? Where are you failing to get the value?Originally posted by oyisHi,
I have a JSP page same as yours.
I can select the checkbox but I can't get the values...
I want to select the checkbox and it gives me value of data.
all things must be dynamically.
please helppp me :(Comment
-
ı think , if I sent my code you can understand easily;Originally posted by r035198xCan you be more specific about your problem? Where are you failing to get the value?
create table function;
var tbody = document.getEle mentById('t1'). getElementsByTa gName('tbody')[0];
var row = document.create Element('TR');
var cell1 = document.create Element('TD');
cell1.innerHTML = myA[i];
var cell2 = document.create Element('TD');
cell2.innerHTML = myB[i];
var cell3 = document.create Element('TD');
var checkBox = document.create Element('INPUT' );
checkBox.setAtt ribute("type", "checkbox") ;
cell3.appendChi ld(checkBox);
checkBox.checke d = false;
row.appendChild (cell1);
row.appendChild (cell2);
row.appendChild (cell3);
tbody.appendChi ld(row);
i want to select one or more row to delete from table.
and i want to know which row is selected when i check the checkbox ...
may i explain now?Comment
-
Maybe the guys in the Javascript forum should have a look at this one as well.Originally posted by oyisı think , if I sent my code you can understand easily;
create table function;
var tbody = document.getEle mentById('t1'). getElementsByTa gName('tbody')[0];
var row = document.create Element('TR');
var cell1 = document.create Element('TD');
cell1.innerHTML = myA[i];
var cell2 = document.create Element('TD');
cell2.innerHTML = myB[i];
var cell3 = document.create Element('TD');
var checkBox = document.create Element('INPUT' );
checkBox.setAtt ribute("type", "checkbox") ;
cell3.appendChi ld(checkBox);
checkBox.checke d = false;
row.appendChild (cell1);
row.appendChild (cell2);
row.appendChild (cell3);
tbody.appendChi ld(row);
i want to select one or more row to delete from table.
and i want to know which row is selected when i check the checkbox ...
may i explain now?
P.S Copied to Javascript forumComment
Comment