Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:46:14+00:00 2026-06-03T14:46:14+00:00

I created a dynamic table in ASP/VBScript that populates a table from a recordset.

  • 0

I created a dynamic table in ASP/VBScript that populates a table from a recordset. Using a DO LOOP a new row is created for each new EmployeeID. The drop-down lists have 2 options: “check-in” and “check-out.” If “check-in” is selected the comment box will remain disabled and if the “check-out” item is selected the comment box will be enabled; both options will generate a date when selected.

The problem is that the drop-down list only works on the first row.

I know I need to rewrite the code so it will call the test() function each time there is a new row.

So is there some way I can clone the function and have it execute for each row? I’ve already tried making the function name and IDs dynamic by adding a rowCount to their ID name (example: “id=”TestCmt<%=rowTest%>)

Maybe someone can point me in the right direction? I’ve spent hours on this and I’d like to figure it out (somewhat) on my own 🙂

Here’s some of the code:

 <html xmlns:ntb>
 <head>
  <script language="javascript" type="text/javascript">

  function enable() {
  document.getElementById("TestCmt").readOnly = false;
  document.getElementById("TestCmt").style.backgroundColor = "#FFFFFF";
  document.getElementById("TestCmt").innerHTML = "";
  document.getElementById("TestCmt").style.color = "#000000";
  }

  function disable() {
  document.getElementById("TestCmt").readOnly = true;
  document.getElementById("TestCmt").style.backgroundColor = "#DCDCDC";
  document.getElementById("TestCmt").innerHTML = "";
  }

  function test() {
  <%  if (StoreID > 0) AND (rsTest.bof=FALSE) then %> //Make sure there are employees

  var selectMenuT = document.getElementById("TestStatus");
  selectMenuT.onchange = function () {

    var chosenOptionT = parseInt(this.options[this.selectedIndex].value);
    var textDateT = document.getElementById("TestDate");
    var cmtsT = document.getElementById("TestCmt");


    switch (chosenOptionL) {

    case 0:
    disable();
    textDateT.innerHTML = "";
    cmtsT.innerHTML = <%=rsTest("TestCmt")%>
    break;

    case 1:
    disable();
    var approve = getReviewDate(); //excluded this function from here but it works fine
    textDateT.innerHTML = approve;
    break;

    case 2:
    enable();
    var reject = getReviewDate();
    textDateL.innerHTML = reject;
    break;
    }
   }
   <% end if %>
  } 
  </script>
 </head>

<body>

<%  if (StoreID > 0) and rsTest.BOF=FALSE then %> 

 <span class="header">Test Playground - Store# <%=rsStore("StoreNo")%></span>

 <table class="table" name="StoreTable" cellpadding="1" cellspacing="0">
  <tr>
   <td class="TestHeader">Store No.</td>
   <td class="TestHeader">Check-In Status</td>
   <td class="TestHeader">Date</td>
   <td class="TestHeader">Comments</td>
 </tr>

<%         
  dim i3, iStr3
  dim rowTest
  rowTest = 0

  do until rsTest.EOF 
  i3=clng(rsTest("EmployeeID"))
  iStr3=right("000"+cstr(i3),4)
  rowTest = rowTest + 1
%>

 <tr>
   <!-- Store No.-->
   <td>
    <% if StoreID > 0 then %>
    <label id="TestRN<%=rowTest%>"></label>
   </td>

  <!-- Check-In Status-->
  <td class="TestData" valign="top">
    <select id="TestStatus<%=rowTest%>" style="width:100%" **onchange="test()"**>
      <option value="0">&lt;Select one&gt;</option>
      <option value="1">Check-In</option>
      <option value="2">Check-Out</option>
    </select>
  </td>

  <!--Date-->
  <td valign="top">
    <input type="hidden" name="Sequence<%=iStr3%>" id="Sequence<%=iStr3%>">
    <label ID="TestDate<%=rowTest%>" class="TestData"><%=rowTest%></label>
  </td>

  <!--Comments-->
  <td valign="middle">
    <textarea id="TestCmt<%=rowTest%>" rows="2" style="textarea" ReadOnly ></textarea>
  </td>
  <% end if %>
</tr>

 <%
 rsTest.MoveNext
 loop 
 %>

 </table>
 <% end if %>

 </body>
</html>

Any help is appreciated.

Signed: The Learning Noob

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:46:16+00:00Added an answer on June 3, 2026 at 2:46 pm

    Thanks for the help.

    I ended up placing the <%=rowTest%> counter in each of my IDs and function names. This in turn generated a test() function (e.g., “test_1 ()”, “test_2 ()”) for each row ID.

    Example:

    function test()_<%=rowTest%> {
    ...
    }
    
    ...
    <select id="TestStatus<%=rowTest%>" style="width:100%" onchange="test()_<%=rowTest%>">  
      <option value="0">&lt;Select one&gt;</option>  
      <option value="1">Check-In</option>  
      <option value="2">Check-Out</option>  
    </select>  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a dynamic list picker script using Jquery 1.3 and PHP that
I have a listview that loads dynamic controls from xml/xslt <asp:ListView ID=DynamicFields runat=server DataSourceID=CustomFields
I am using ASP.NET Dynamic Data for a project and I have a table
I created a page in ASP that loads dynamic content with code similar to
I am making a dynamic table that will add rows whenever the add row
I have created a dynamic div, along with the table...I want that when i
I am new in flex.I have created dynamic web project. Run it. It accessible
I am working on Moodle 2.2.1 and have created dynamic.csv files using certain queries.
i have some problem.. i have created a dynamic button in a table view.
In ASP.NET 3.5 I have a datagrid that is bound to a somwehat dynamic

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.