|
-
Aug 23rd, 2000, 04:20 PM
#1
Thread Starter
Addicted Member
I have a form whose number of hidden fields grows dynamically. I employ a naming convention such as <itemName>_Number for the names of the hidden fields.
Here's an example of part of a form:
Code:
<input type="hidden" name="itemNum_4">
<input type="hidden" name="desc_4">
<input type="hidden" name="quantity_4">
<input type="hidden" name="issue_4">
<input type="hidden" name="unit_4">
<input type="hidden" name="itemNum_5">
<input type="hidden" name="desc_5">
<input type="hidden" name="quantity_5">
<input type="hidden" name="issue_5">
<input type="hidden" name="unit_5">
<input type="hidden" name="itemNum_6">
<input type="hidden" name="desc_6">
<input type="hidden" name="quantity_6">
<input type="hidden" name="issue_6">
<input type="hidden" name="unit_6">
My problem is how to process this form??
I'm not quite sure how to loop through the Form collection to get at all these fields for which I don't know the exact name. Once I get the field name, I can parse it and determine how to procede.
I think this is probably fairly simple, but all the form processing I have done thus far involved only forms for which I knew exactly which fields were in the form. Variable length forms seem a bit tougher to tackle.
Please let me know.
dvst8
[Edited by dvst8 on 08-23-2000 at 05:24 PM]
Secret to long life:
Keep breathing as long as possible.
-
Aug 24th, 2000, 02:57 AM
#2
Fanatic Member
are you using asp to process the form ?
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Aug 24th, 2000, 04:27 AM
#3
New Member
Yon can do like that if you use vbscript:
Code:
<%Dim i
For i = 1 To NumberofItems%>
<input type="hidden" name="itemNum_" & <%=CStr(i)%>>
<input type="hidden" name="desc_" & <%=CStr(i)%>
<input type="hidden" name="quantity_" & <%=CStr(i)%>>
<input type="hidden" name="issue_" & <%=CStr(i)%>>
<input type="hidden" name="unit_" & <%=CStr(i)%>>
<%Next%>
Nicolas Joannidès
C, C++, Visual Basic, ASP
[email protected]
-
Aug 24th, 2000, 04:38 AM
#4
Fanatic Member
If you are using asp to get the field names use the following
Code:
set fieldsfromform = request.form
for each item in fieldsfromform
response.write "The name of the field is " & item & "<br>"
response.write "The value of the field is " & fieldsfromform(item) & "<br>"
next
Hope this helps
ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Aug 24th, 2000, 10:53 AM
#5
Thread Starter
Addicted Member
Thanks guys. that's exactly what i needed.
d
Secret to long life:
Keep breathing as long as possible.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|