Menu

How to access nested table inside a form.

Anonymous
2002-12-22
2002-12-23
  • Anonymous

    Anonymous - 2002-12-22

    I need to access a nested table inside a form so that i can select a particular row and modify or delete it.
    getTables() or getTablesWithID() or any other method only gives me the top level tables but not the child table i need.
    I have tried iterating through loops and used all possible methods but cant access the nested table.

    I will appreciate any response in this matter.
    Thx

     
    • Russell Gold

      Russell Gold - 2002-12-22

      GetTableWithID will return the table with the ID, whether nested or not. If you believe you have a case where this is not so, please submit a very small HTML page that demonstrates the problem.

       
    • Anonymous

      Anonymous - 2002-12-22

      Thx for the quick response.
      Here is a very small code snippet. As u can see , I have 2 nested table with same ID. Can u tell me how to get around with this kind of problem?

      <!-- Main table -->
      <table width="100%" border="0" cellpadding="0" cellspacing="0" id="pagetable">
      <form name="form2" id="form2" method="post" action="BTAction">
      <input type="hidden" name="Page" value="BTListCustEnvironmentsPage"></input>
      <!-- Nested tables -->
              <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="titlebar">
          ...
          </table>

          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="content">
          ...
          </table>

          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="content">
          ...
          </table>
      <!-- End of Nested tables -->

      </table>
      <!-- End of Main table -->

       
      • Russell Gold

        Russell Gold - 2002-12-23

        Well now that is clumsy. The HTML spec says that id values are supposed to be unique, so what you have is not strictly legal. Assuming that you cannot do anything about this (many HTML coders just don't care about the specs), you have a few options. First, you can rely on the positions of the tables:

        response.getTables()[2].getTableCell(1,1).getTables[3]

        returns the 3rd table nested in cell (1,1) of the second table. I don't like to do that since I cannot trust the HTML to remain static.

        The next thing to try is to rely on the contents of the first non-blank cell in the tables. getTableStartingWith( "xxx" ) could be helpful there.

        But do try to get the ids unique.

         
    • Anonymous

      Anonymous - 2002-12-22

      Thx for the quick response.
      Here is a very small code snippet. As u can see , I have 2 nested table with same ID. Can u tell me how to get around with this kind of problem?

      <!-- Main table -->
      <table width="100%" border="0" cellpadding="0" cellspacing="0" id="pagetable">
      <form name="form2" id="form2" method="post" action="BTAction">
      <input type="hidden" name="Page" value="BTListCustEnvironmentsPage"></input>
      <!-- Nested tables -->
              <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="titlebar">
          ...
          </table>

          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="content">
          ...
          </table>

          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" id="content">
          ...
          </table>
      <!-- End of Nested tables -->

      </table>
      <!-- End of Main table -->

       

Log in to post a comment.

Auth0 Logo