I have an ASP page that is creating a table of inputs which are being 
dynamically named based on the column values from the table.
Basically what I'm doing is iterating through my recordset and 
writing out a table, i.e.,

Do While Not rsTemp.EOF
  For Each objColumn In rsTemp.Fields
    Response.Write "<input type='text' name='" & rsTemp("recordid")  
rsTemp("objColumn.Name") & "' />"
  Next
  rsTemp.MoveNext
Loop

The problem doesn't come into play until I submit this form with 
beaucoup fields in it.  What I'm wanting to do is iterate through the 
forms collection and parse back out both the form field name and the 
form field value.  So I try a couple of different ways to do that.

The first thing I do is the following:
Dim fieldCount = Request.Form.Count
For i = 1 to fieldCount
  Response.Write Request.Form(i) & "<br />" & vbcrlf
Next

This works great for displaying the form field values in order, but 
it won't show me the form field name.  

So then I try this:
For Each frmField In Request.Form
  Response.Write myItem & " &#150; [" & Request.Form(myItem) & "]
<br />" & vbcrlf
Next

This works well for showing the name of the field as well as the 
value, but with on major problem.  While the first loop displayed the 
field values in the correct order, the second loop appears to have 
displayed them completely at random.
For example, lets say my form had 5 fields in it 
named "1fname", "2fname", "3fname", "4fname" and "5fname".
The HTML output that my first ASP page creates would be something 
along these lines (obviously shortened for this example)...
<table>
  <tr>
    <td><input type="text" name="1fname" value="Mark" /></td>
    <td><input type="text" name="2fname" value="Todd" /></td>
    <td><input type="text" name="3fname" value="Jim" /></td>
    <td><input type="text" name="4fname" value="Steve" /></td>
    <td><input type="text" name="5fname" value="Carl" /></td>
  </tr>
</table>
By using array notation to iterate through the forms collection, the 
loop will return the following
Mark
Todd
Jim
Steve
Carl

By using the For Each...In loop to iterate through the forms 
collection, the results might be something like this...

Todd
Carl
Steve
Jim
Mark

WHY?




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/saFolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to