Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP CDO
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 22nd, 2005, 04:58 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default ObjMail.To is dependant on drop-down selection

Hi
I know this has to do with the SELECT () CASE statements in ASP. But I'm not sure how to make this work properly.
Brief: I have a form that when submitted goes to different recipients depending on a selection they have previously made from a drop-down list.

Something like:
<%
SELECT Case varDept
CASE "Finance Dept."
      ObjMail.to: [email protected]

CASE "Marketing Dept."
      ObjMail.to: [email protected]

CASE "Another Dept."
      ObjMail.to: [email protected]

End SELECT
%>

Id it as simple as I've described? If so I'm must be missing something because as it is, it isn't working.

Thanks always for all your help,
nancy
 
Old February 22nd, 2005, 09:09 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Plase check if u get the valus in varDept variable.

following is the syntax of sending mail:

<%
    Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
    MyCDONTSMail.From= "[email protected]"
    MyCDONTSMail.To= "[email protected]"
    MyCDONTSMail.Subject="This is a Test"
    MyBody = "Thank you for ordering that stuff" & vbCrLf
    MyBody = MyBody & "We appreciate your business" & vbCrLf
    MyBody = MyBody & "Your stuff will arrive within 7 business days"
    MyCDONTSMail.Body= MyBody
    MyCDONTSMail.Send
    set MyCDONTSMail=nothing
%>

Your select statement will be:

SELECT Case varDept
CASE "Finance Dept."
      MyCDONTSMail.To= "[email protected]"
CASE "Marketing Dept."
      MyCDONTSMail.To= "[email protected]"
CASE "Another Dept."
      MyCDONTSMail.To= "[email protected]"
End SELECT


Om Prakash
 
Old February 23rd, 2005, 11:03 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your feedback. However, it doesn't work. In fact it doesn't recognize the get.asp (page with the email instructions).

Here's the section of my form plus the asp code that gets the information from the form:

HTML FORM section:

************************************************** **

<select name="t1">

          <option value="information type A" selected>type A</option>
          <option value="information type B">type B</option>
          <option value="information type C">type C</option>
          <option value="information type D">type D</option>
          <option value="information type E">type E</option>
          <option value="Other">Other</option>
        </select>

************************************************** **


Here's the code in get.asp:

************************************************** ***

SELECT Case t1
CASE "information type A"
      ObjMail.To = "[email protected]"
CASE "information type B"
      ObjMail.To = "[email protected]"
CASE "information type C"
      ObjMail.To = "[email protected]"
CASE "information type D"
      ObjMail.To = "[email protected]"
CASE "information type E"
      ObjMail.To = "[email protected]"
End SELECT

************************************************** **


When completing the form (with a valid ObjMail.From value), and submitting it, get.asp cannot be displayed: HTTP 500 - Internal server error

What am I missing??

Thanks
nancy

************************************************** ***
 
Old February 23rd, 2005, 12:56 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Modify
SELECT Case t1
as
SELECT Case request.form("t1")


Om Prakash
 
Old February 23rd, 2005, 01:52 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It still isn't working. Same error message ???
 
Old February 23rd, 2005, 01:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think you should turn off "Friendly HTTP Error Messages" as per the instructions in this FAQ: http://Imar.Spaanjaars.Com/QuickDocId.aspx?QUICKDOC=264

Then post the actual error message to this list....

Cheers,

Imar
 
Old February 23rd, 2005, 02:41 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you it is working.
 
Old February 23rd, 2005, 02:47 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Would you like to share the solution? That may help someone else in the future when they run into a thread like this one.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old February 23rd, 2005, 02:55 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Actually the code suggested was the solution. What was preventing it from working properly had to do with syntax on my part.

The solution is actually in the thread that reads:

Select CASE request.form("t1")

instead of what I had initially coded which was:

Select CASE t1

Hope this helps,
nancy





Similar Threads
Thread Thread Starter Forum Replies Last Post
add drop down / combo box for selection mamuco Classic ASP Components 0 May 30th, 2007 06:34 PM
Populate fields from drop-down selection SimonL Infopath 0 April 12th, 2007 07:30 AM
Dependant Dropdown Help phoenix211984 Dreamweaver (all versions) 0 October 11th, 2006 02:47 PM
Populating web form with drop down list selection AugieDawgie ASP.NET 1.0 and 1.1 Basics 0 December 7th, 2005 11:44 AM
Java script function on drop down list selection Sachin3k Javascript How-To 3 April 30th, 2005 11:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.