[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

How can I get the rowcount of a dynamic table using VBScript

Asked by pborregg in VB Script, Active Server Pages (ASP)

Tags: VB / VB Script, ASP

I have a dynamic table I've created on one page... the user can add/delete any number of rows they wish. The code is below.

What I want to do is capture the final rowcount of the table from the DOM.  Does that make sense?

The code works, but now using multipart/form-data I want to capture the dynamic rows and the rowcount so i can loop through the rows grabbing the data and pumping into a MS SQL Server database table.

All I need is how to get the values of the rows.

I know is JSP you use getParameterName() but how in VB Script with a dynamic table?

thanks,

peter
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
function addRow(tableID) 
                                {   
  
            var table = document.getElementById(tableID);   
  
            var rowCount = table.rows.length;   
            var row = table.insertRow(rowCount);   
  
            var colCount = table.rows[0].cells.length;   
  
            for(var i=0; i<colCount; i++) 
                                                {   
  
                var newcell = row.insertCell(i);   
  
                newcell.innerHTML = table.rows[0].cells[i].innerHTML;   
                //alert(newcell.childNodes);   
                switch(newcell.childNodes[0].type) 
                                                                {   
                    case "text":   
                            newcell.childNodes[0].value = "";   
                            break;   
                    case "checkbox":   
                            newcell.childNodes[0].checked = false;   
                            break;   
                    case "select-one":   
                            newcell.childNodes[0].selectedIndex = 0;   
                            break;   
                }   
            }   
        }   
  
        function deleteRow(tableID) 
                                { 
            try 
                                                {   
                                                                var table = document.getElementById(tableID);   
                                                                var rowCount = table.rows.length;   
  
            for(var i=0; i<rowCount; i++) 
                                                {  
                var row = table.rows[i];   
                var chkbox = row.cells[3].childNodes[0];  
                                                                
                if(null != chkbox && true == chkbox.checked) 
                                                                {  
                    if(rowCount <= 1) 
                                                                                {   
                        alert("Cannot delete all the rows.");   
                        break;   
                    }   
                    table.deleteRow(i);   
                    rowCount--;   
                    i--;   
                }   
  
            }   
            } catch(e) {   
              alert("Problem");   
            }   
        }   
 
 
<table width="100%" border="0" cellspacing="2" cellpadding="1" id="dataTable">
     <tr>
        <td width="19%" align="left"><select name="skill" id="skill">
          <option value="X" selected="selected">SELECT ONE</option>
          <option value="S">Skill</option>
          <option value="K">Knowledge</option>
        </select></td>
        <td width="52%" align="left"><input name="skill_area" type="text" id="skill_area" size="50" maxlength="100" /></td>
        <td width="14%" align="left"><select name="rating" id="rating">
          <option value="0" selected="selected">SELECT ONE</option>
          <option value="1">1 - None</option>
          <option value="2">2 - Basic</option>
          <option value="3">3 - Average</option>
          <option value="4">4 - Good</option>
          <option value="5">5 - Proficient</option>
        </select></td>
        <td width="15%" align="left"><input type="checkbox" name="chk" id="chk" /></td>
        </tr>
    </table>
[+][-]08/10/09 06:32 AM, ID: 25059730Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: VB Script, Active Server Pages (ASP)
Tags: VB / VB Script, ASP
Sign Up Now!
Solution Provided By: rg20
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625