By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,142 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,142 IT Pros & Developers. It's quick & easy.

Dreamweaver problem passing form values with server behaviour

P: 87
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:

Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <% OPTION EXPLICIT %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>Confirmation of EZ Project Update</title>
  8. </head>
  9.  
  10. <body>
  11. EZ Project Update Confirmation<br />
  12. <br />
  13. <table width="100%" height="180" border="0">
  14. <tr>
  15. <td><div align="center">
  16. <div align="left">
  17.  
  18. <%
  19. 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
  20.  
  21. ProjID = Request.form("ID")
  22. EntryDate = Request.form("EntryDate")
  23. PFIT = Request.form("PFIT_Contact")
  24. MD = Request.form("SSPA_Org")
  25. EZWS = Request.form("EZ_Strategic_Workstream")
  26. ProgrNm = Request.form("Program_Name")
  27. ProjNm = Request.form("Project_Name")
  28. ProjDescr = Request.form("ProjectDescription")
  29. WC = Request.form("Work_Category")
  30. Stat = Request.form("Status")
  31. Scop = Request.form("Scope")
  32. FDXFY = Request.form("FY")
  33. Quarter = Request.form("Qtr")
  34. CalMth = Request.form("Mth")
  35.  
  36.  
  37. 'FN = Request.form("FirstName")
  38. 'LN = Request.Form("LastName")
  39. 'EMPID = Request.Form("EmployeeID")
  40. 'EML = Request.Form("Email")
  41. Paragr1 = "TEXT HERE:"
  42. Paragr2 = "This is an automated message. Please do not respond to this email."
  43. 'Paragr3 = "TEXT FOR THIRD PARAGRAPH"
  44.  
  45. bl = " "
  46. BR = "<BR>"
  47. BK = "<BR><BR>"
  48. UND = "<u>"
  49. ENDUND = "</u>"
  50.  
  51.  
  52. 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)
  53.  
  54. Set myCDONTSMail = Server.CreateObject("CDONTS.NewMail")
  55. 'MyCDONTSMail.From = EML
  56. MyCDONTSMail.From = "myemail@home.com"
  57. MyCDONTSMail.To = "myemail@home.com"
  58. 'MyCDONTSMail.cc = "myemail@home.com"
  59. MyCDONTSMail.Subject = ":: Notice of EZ Project Update ::"
  60. 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)
  61. MyCDONTSMail.BodyFormat = 0 'this makes it HTML
  62. MyCDONTSMail.MailFormat = 0 'this makes it HTML</strong>
  63. MyCDONTSMail.Send
  64.  
  65. Set MyCDONTSMail=nothing
  66.  
  67. %>
  68.  
  69.  
  70. </div>
  71. </div>
  72. </tr>
  73. </table>
  74. </body>
  75. </html>
Any help would be greatly appreciated.

- JM
May 8 '08 #1
Share this Question
Share on Google+
5 Replies


DrBunchman
Expert 100+
P: 979
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
May 8 '08 #2

P: 87
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?
May 8 '08 #3

DrBunchman
Expert 100+
P: 979
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:
Expand|Select|Wrap|Line Numbers
  1.  
  2. If Request("Var1") <> "" Then Session("Var1")  = Request("Var1")
  3.  
And then retrieve them on your confirmation page like so:
Expand|Select|Wrap|Line Numbers
  1.  Dim sVar1 
  2. sVar1 = Session("Var1")
  3.  
Hope this helps,

Dr B
May 9 '08 #4

P: 87
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:

Expand|Select|Wrap|Line Numbers
  1. If Request("Var1") <> "" Then Session("Var1")  = Request("Var1")
  2. If Request("Var2") <> "" Then Session("Var2")  = Request("Var2")
  3. If Request("Var3") <> "" Then Session("Var3")  = Request("Var3")
On my confirmation page:

Expand|Select|Wrap|Line Numbers
  1. Dim sVar1, sVar2, sVar3
  2. sVar1 = Session("Var1")
  3. sVar2 = Session("Var2")
  4. sVar3 = Session("Var3")
May 13 '08 #5

DrBunchman
Expert 100+
P: 979
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
May 13 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.