This is a discussion on "Multi page form" within the Classic ASP section. This forum, and the thread "Multi page form are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Multi page form
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Multi page form
Hi
Well I have a major problem and I was informed that this is a good forum for help with asp. This is my problem. I have a form that has about 50 questions and I need to split it into 3 pages. When everything is filled out I would like to send all the info with CDOSYS or CDO not CDONTS. I have had no problems getting all this to work with this script below except that all the info is not sorted. When I only have one question per page it works fine, when I add about 15 questions on each page and then send it all the questions appear in the email body but not in order. They appear randomly and I can't figure out how I should sort this... Any ideas. I really need this to work.. Here is the code... <% Sub SendHiddenFormFields () For Each Field In Request.Form TheString = "<input type=""hidden"" " _ & "name=""" & Field & """ value=""" Value = Request.Form(Field) TheString = TheString + CStr(Value) & """>" & vbCrLf Response.Write TheString Next End Sub Sub ReadFormVariables() For Each Field In Request.Form TheString = Field & " = Request.Form(""" & Field & """)" Execute(TheString) Next End Sub %> <!--METADATA TYPE="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" NAME="CDO for Windows 2000 Library" --> <!--METADATA TYPE="typelib" UUID="00000205-0000-0010-8000-00AA006D2EA4" NAME="ADODB Type Library" --> <FORM METHOD="post"> <% Dim sNextStep sNextStep = request.form("current") If sNextStep = "" Then sNextStep = 1 Else sNextStep = CINT(sNextStep) + 1 End If for each i in Request.Form if left(i,1)="s" then Response.write("<INPUT TYPE=hidden NAME='" & i & "' VALUE='" & Request.Form(i) & "'>") end if next Response.write("<INPUT TYPE=""hidden"" NAME=""current"" VALUE=""" & sNextStep & """>") ' Output form for next step select case sNextStep case "1": ' step 1 %> <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=#EEEEEE ALIGN=CENTER> <TR><TD>Name</TD><TD><INPUT TYPE="text" NAME="s1_Name"></TD></TR> <TR><TD>Age</TD><TD><INPUT TYPE="text" NAME="s1_Age"></TD></TR> <TR><TD>Address</TD><TD><INPUT TYPE="text" NAME="s1_Address"></TD></TR> <TR><TD>Country</TD><TD><INPUT TYPE="text" NAME="s1_Country"></TD></TR> <TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=submit VALUE="Next..."> </TABLE> <% case "2": ' Step 2 %> <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=#EEEEEE ALIGN=CENTER> <TR><TD>Name</TD><TD><INPUT TYPE="text" NAME="s1_Name2"></TD></TR> <TR><TD>Age</TD><TD><INPUT TYPE="text" NAME="s1_Age2"></TD></TR> <TR><TD>Address</TD><TD><INPUT TYPE="text" NAME="s1_Address2"></TD></TR> <TR><TD>Country</TD><TD><INPUT TYPE="text" NAME="s1_Country2"></TD></TR> <TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=submit VALUE="Next..."> </TABLE> <% case "3": ' Step 3 %> <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=#EEEEEE ALIGN=CENTER> <TR><TD>Name</TD><TD><INPUT TYPE="text" NAME="s1_Name3"></TD></TR> <TR><TD>Age</TD><TD><INPUT TYPE="text" NAME="s1_Age3"></TD></TR> <TR><TD>Address</TD><TD><INPUT TYPE="text" NAME="s1_Address3"></TD></TR> <TR><TD>Country</TD><TD><INPUT TYPE="text" NAME="s1_Country3"></TD></TR> </TD></TR> <TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=submit VALUE="Next..."></TD></TR> </TABLE> <% case "4": ' Step 4% body = "" for each i in Request.Form if left(i,1)="s" then body = body & Mid(i,2) & ": " & Request.Form(i) & vbNewLine End If Next set objMessage = CreateObject("CDO.Message") objMessage.To = "mail@mail.se" objMessage.From = "mail@mail.se" objMessage.Subject = "Test CDO Message" objMessage.Sender = "mail@mail.se" objMessage.Textbody = body + vbNewLine set objConfig = CreateObject("CDO.Configuration") objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort objConfig.Fields(cdoSMTPServer) = "192.168.100.20" objConfig.Fields(cdoSMTPServerPort) = 25 objConfig.Fields(cdoSMTPAuthenticate) = cdoAnonymous objConfig.Fields.Update set objMessage.Configuration = objConfig objMessage.Send set objConfig = Nothing set objMessage = Nothing End Select %> </FORM> |
|
|
|
|||
|
Instead of using a FOR EACH in building the email body make an array of the field names in the order you want them, then do a FOR loop through the array building the email body with that.
Lemme know if you need more details on how to do that, but that's the general concept. |
|
|||
|
I'm sorry to say that I do need some more details on what you just said.
|
|
|||
|
No problem. Replace this line
<blockquote id="quote"><font size="1" face="geneva, verdana, arial" id="quote">quote:<hr height="1" noshade id="quote">for each i in Request.Form<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"> With
|
![]() |
| Tags |
| multi, page, form |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi-league and Multi-tiered team schedule | overkil6 | Website Planning | 3 | Jun 17th, 2008 22:04 |
| Form Submission page | markusdavid | Web Page Design | 3 | Sep 8th, 2007 00:50 |
| Help creating a Multi line order form | wacara | Classic ASP | 0 | Apr 23rd, 2007 18:25 |
| Form action same as form page? | Tim356 | PHP Forum | 2 | Jun 20th, 2005 03:32 |
| Submitting a form on one page! | courtjester | Classic ASP | 5 | Sep 10th, 2004 19:03 |