Problem with selecting Check box in a jsp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chindanoor
    New Member
    • Apr 2007
    • 13

    #1

    Problem with selecting Check box in a jsp

    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...
  • sumittyagi
    Recognized Expert New Member
    • Mar 2007
    • 202

    #2
    Originally posted by chindanoor
    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...
    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.

    Comment

    • anilraghuvanshi
      New Member
      • Jul 2007
      • 4

      #3
      Originally posted by chindanoor
      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...

      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

      • oyis
        New Member
        • Jul 2007
        • 8

        #4
        Originally posted by chindanoor
        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...
        Hi,
        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

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by oyis
          Hi,
          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 :(
          Can you be more specific about your problem? Where are you failing to get the value?

          Comment

          • oyis
            New Member
            • Jul 2007
            • 8

            #6
            Originally posted by r035198x
            Can you be more specific about your problem? Where are you failing to get the value?
            ı 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?

            Comment

            • r035198x
              MVP
              • Sep 2006
              • 13225

              #7
              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?
              Maybe the guys in the Javascript forum should have a look at this one as well.
              P.S Copied to Javascript forum

              Comment

              Working...