Dreamweaver problem passing form values with server behaviour
Question posted by: jmartmem
(Member)
on
May 8th, 2008 06:18 PM
Greetings,
I have built an Update Record Form in an ASP page. This form contains a number of fields, such as text boxes and menus, to name a few.
Upon clicking the 'submit' button, I want the form values to pass to a confirmation page that shows the values entered and selected, with a CDONTS auto email generated at the same time. My problem is that I'm having trouble passing the values from the form to both the confirmation page and the auto email.
The confirmation page loads fine, and the auto email is generated. The only piece missing is passing the form values to both.
Here is the CDONTS code from my confirmation page:
Code: ( text )
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% OPTION EXPLICIT %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Confirmation of EZ Project Update</title> </head> <body> EZ Project Update Confirmation<br /> <br /> <table width="100%" height="180" border="0"> <tr> <td><div align="center"> <div align="left"> <% Dim ProjID, EntryDate, PFIT, MD, EZWS, ProgrNm, ProjNm, ProjDescr, WC, Stat, Scop, FDXFY, Quarter, CalMth, FN, LN, EMPID, EML, myCDONTSMail, Paragr1, bl, Paragr2, Paragr3, BK, BR, UND, ENDUND ProjID = Request.form("ID") EntryDate = Request.form("EntryDate") PFIT = Request.form("PFIT_Contact") MD = Request.form("SSPA_Org") EZWS = Request.form("EZ_Strategic_Workstream") ProgrNm = Request.form("Program_Name") ProjNm = Request.form("Project_Name") ProjDescr = Request.form("ProjectDescription") WC = Request.form("Work_Category") Stat = Request.form("Status") Scop = Request.form("Scope") FDXFY = Request.form("FY") Quarter = Request.form("Qtr") CalMth = Request.form("Mth") 'FN = Request.form("FirstName") 'LN = Request.Form("LastName") 'EMPID = Request.Form("EmployeeID") 'EML = Request.Form("Email") Paragr1 = "TEXT HERE:" Paragr2 = "This is an automated message. Please do not respond to this email." 'Paragr3 = "TEXT FOR THIRD PARAGRAPH" bl = " " BR = "<BR>" BK = "<BR><BR>" UND = "<u>" ENDUND = "</u>" response.write Paragr1 & BK & "Project ID: " & bl & ProjID & BR & "Entry Date: " & bl & EntryDate & BR & "PFIT Contact: " & bl & PFIT & BR & "Owning SSPA MD/Mgr: " & bl & MD & BK & "EZ Strategic Workstream: " & bl & EZWS & BR & "Program Name: " & bl & ProgrNm & BR & "Project Name: " & bl & ProjNm & BR & "Project Description: " & bl & ProjDescr & BK & "Project Phase: " & bl & WC & BR & "Status: " & bl & Stat & BR & "Scope: " & bl & Scop & BK & UND & "Planning Rollout Timeline" & ENDUND & BR & "FedEx FY: " & bl & FDXFY & BR & "FedEx Fiscal Quarter: " & bl & Quarter & BR & "Calendar Month: " & bl & CalMth & BK & Paragr2 & BK & chr(13) Set myCDONTSMail = Server.CreateObject("CDONTS.NewMail") 'MyCDONTSMail.From = EML MyCDONTSMail.From = "myemail@home.com" MyCDONTSMail.To = "myemail@home.com" 'MyCDONTSMail.cc = "myemail@home.com" MyCDONTSMail.Subject = ":: Notice of EZ Project Update ::" MyCDONTSMail.Body = Paragr1 & BK & "Project ID: " & bl & ProjID & BR & "Entry Date: " & bl & EntryDate & BR & "PFIT Contact: " & bl & PFIT & BR & "Owning SSPA MD/Mgr: " & bl & MD & BK & "EZ Strategic Workstream: " & bl & EZWS & BR & "Program Name: " & bl & ProgrNm & BR & "Project Name: " & bl & ProjNm & BR & "Project Description: " & bl & ProjDescr & BK & "Project Phase: " & bl & WC & BR & "Status: " & bl & Stat & BR & "Scope: " & bl & Scop & BK & UND & "Planning Rollout Timeline" & ENDUND & BR & "FedEx FY: " & bl & FDXFY & BR & "FedEx Fiscal Quarter: " & bl & Quarter & BR & "Calendar Month: " & bl & CalMth & BK & Paragr2 & BK & chr(13) MyCDONTSMail.BodyFormat = 0 'this makes it HTML MyCDONTSMail.MailFormat = 0 'this makes it HTML</strong> MyCDONTSMail.Send Set MyCDONTSMail=nothing %> </div> </div> </tr> </table> </body> </html>
Any help would be greatly appreciated.
- JM
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Re: Dreamweaver problem passing form values with server behaviour
Hi JM,
Can you confirm for me exactly what the problem is: is the data being displayed on the page correctly but not being included in your message body?
If so then the problem lies with the way you are assigning the Body property of your CDONTS mail object. The first thing you should do is change your CDONTS object, which is not used anymore, for CDOSYS. They are broadly similar and there is a good example here. You'll see there is an example which uses the HTMLBody property which you can follow to send an html formatted e-mail.
Let me know how you get on,
Dr B
Re: Dreamweaver problem passing form values with server behaviour
Actually, the problem is that the Request.Form values from my many DIMs are not appearing in the MyCDONTSMail.Body nor the response.write portion of the page.
I'm using Dreamweaver to design the page and since my last post I understand that while request variables are the usual way of passing form data from one page to another, Dreamweaver's Insert Record, Update Record and Delete Record server behaviors will not allow this method.
Does this help?
Re: Dreamweaver problem passing form values with server behaviour
I would still advise you to change your mail object to CDOSYS as this is the currently accepted standard.
As for the Dreamweaver problem i would suggest that you use session variables to pass data to your page. The reason that your request variables aren't being passed is because of the way the the server behaviours work. When the form is submitted, the page calls itself and then response.redirects to the intended page. This of course means the all request variables are lost between the two pages as these are not passed through a redirect.
Try something like the following on the page which you are trying to pass the variables from:
Code: ( text )
If Request("Var1") <> "" Then Session("Var1") = Request("Var1")
And then retrieve them on your confirmation page like so:
Code: ( text )
Dim sVar1 sVar1 = Session("Var1")
Hope this helps,
Dr B
|
|
May 13th, 2008 09:05 PM
# 5
|
Re: Dreamweaver problem passing form values with server behaviour
That worked, Dr. B. Thanks.
For multiple variables I want to pass between the pages, would I simply add additional lines of code?
Such as this...on the page I'm trying to pass the variables from:
Code: ( text )
If Request("Var1") <> "" Then Session("Var1") = Request("Var1") If Request("Var2") <> "" Then Session("Var2") = Request("Var2") If Request("Var3") <> "" Then Session("Var3") = Request("Var3")
On my confirmation page:
Code: ( text )
Dim sVar1, sVar2, sVar3 sVar1 = Session("Var1") sVar2 = Session("Var2") sVar3 = Session("Var3")
|
|
May 13th, 2008 09:51 PM
# 6
|
Re: Dreamweaver problem passing form values with server behaviour
Yes i'm afraid that you'll have to do that for each variable. The only alternative would be to pass the variables as an array through the session object but to be honest I don't think it's worth it.
Glad to hear you got it working,
Dr B
Not the answer you were looking for? Post your question . . .
174,849 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Top ASP Forum Contributors
|