Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 2nd, 2006, 10:28 AM   #1
rag05
Newbie
 
rag05's Avatar
 
Join Date: Oct 2005
Location: Texas
Posts: 11
Rep Power: 0 rag05 is on a distinguished road
Help on Form Submit

Hello all,

I'm trying to submit the values in a form and put them into a string using the following code:

for each objField in Request.Form
    str = str & objField & ": " & Request.Form(objField) & "<br>"
next

This is the problem: let's say that my form has the following fields (in that order):

First Name
Middle Initial
Last Name

When I print out the contents of the string, the order is not the same... it might be:

Middle Initial
Last Name
First Name

So that's my question: is there any way (using the same piece of code, or similar) that I can save the form values into a string in the same order they appear on the form?

I appreciate your help. Thanx
__________________
There are only two kinds of programming languages:
those people always bitch about and those nobody uses.

-- Bjarne Stroustrup
rag05 is offline   Reply With Quote
Old Apr 14th, 2006, 12:57 PM   #2
theGuru
Newbie
 
Join Date: Apr 2006
Posts: 2
Rep Power: 0 theGuru is on a distinguished road
I think they should appear in the same order as they were on the form.
theGuru is offline   Reply With Quote
Old Dec 1st, 2006, 5:24 PM   #3
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 314
Rep Power: 4 mackenga is on a distinguished road
Hmm. I think it could be the For Each traversing the collection in an arbitrary order. What happens if you use a For loop, like:

For I = 1 To objSomeCollection.Count
    strResult = strResult & objSomeCollection.Item(I).Value & "<BR>"
Next

Sorry this isn't exactly what you're doing but I haven't done a lot with ASP; hope you get what I mean. I'm not sure if this will help; it won't help if the problem is the browser returning the fields in some arbitrary order and ASP giving them to you in the order in which it received them (which is also very possible; I don't think any standards have anything to say about the order that these arguments should get posted in).

In fact that's a good point - even if your browser turns out to be returning the arguments in the order you expected, there's a good chance there are browsers out there that don't, so you shouldn't rely on the order. Maybe there's some way you can build the correct order into your script, or even specify it in a hidden form element and pass it back to yourself?
__________________
"I'm not a genius. Why do I have to suffer?"
mackenga is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:20 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC