Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sk3pt1c

macrumors 6502a
Original poster
Nov 29, 2005
918
6
a simulacrum
Hello, here's the scenario.
We have an asp page that processes a "request quote" form data from another page, sends them off in an email and then displays a thank you and the title of the page you came from, allowing you to click it to go back.
Seeing as this is a pretty empty page, we're thinking of adding some extra info to it, since it may take up to two days for the visitor to hear back from us, it'd be nice to give them some stuff to read up on and whatnot.
So what i'd need is to check for what package the data is coming from (using asp) and based on that, call a js function to display appropriate links or text.
Is this doable?
I will update with more detailed info if it is, thank you :)
 

Darth.Titan

macrumors 68030
Oct 31, 2007
2,905
753
Austin, TX
Why use js for this? Can't you just echo out the necessary content using ASP?

In any case whatever script is used to display the "thank you" page should be able to just as easily show the requisite javascript code as well.

Am I misunderstanding the question?
 

sk3pt1c

macrumors 6502a
Original poster
Nov 29, 2005
918
6
a simulacrum
Why use js for this? Can't you just echo out the necessary content using ASP?

In any case whatever script is used to display the "thank you" page should be able to just as easily show the requisite javascript code as well.

Am I misunderstanding the question?

Hello, thank you for replying and apologies for not replying sooner.

So the asp script is basically JMail, it takes the form data and emails it.

What I want to make it do is, based on the page the form was on, which i believe is
Code:
<%= Request.Form("url") %>
, output a specific block of content, populate an empty div with it perhaps.

To give you a better idea, it's a site that a visitor will fill a request form for a vacation package.
When they hit Submit, I want to say thanks for submitting and give them a bit more info on the destination on the page they used the form from, maybe some links and perhaps a slideshow or a youtube video.

If I made sense with all that, how would I go about doing it?

Would I store the content in an array and call the specific cell i need for each occasion?

Would that array be stored in the asp page or off it somewhere?

Thanks again for taking the time to help out :)
 

Ap0ks

macrumors 6502
Aug 12, 2008
316
93
Cambridge, UK
How many pages are you putting the form on?

You could put a simple if...then...else in the ASP code to just output the desired content, depending on the submitted URL. You wouldn't need to use any javascript to do that.

Do you have a link to the current form, so we can put this in context?
 

sk3pt1c

macrumors 6502a
Original poster
Nov 29, 2005
918
6
a simulacrum
How many pages are you putting the form on?

You could put a simple if...then...else in the ASP code to just output the desired content, depending on the submitted URL. You wouldn't need to use any javascript to do that.

Do you have a link to the current form, so we can put this in context?

I would probably need around 10 different sets of info for the landing page the asp creates. Here's some of the code:
Code:
<html>
<head>
<title>Confirmation </title>

<link href="../css/styles.css" rel="stylesheet" type="text/css" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body> 

<%
    Set JMail = Server.CreateObject("JMail.SMTPMail")
    JMail.ServerAddress = "localhost"
    JMail.ISOEncodeHeaders = False

    If Request.Form("email") = "" THEN
      JMail.Sender = "email@company.com"
    Else
      JMail.Sender = Request.Form("email")
    End If
    JMail.Subject = "AutoIT::" & Request.Form("package")
    JMail.AddRecipient "email@company.com"
    JMail.Body =  "Name:    " & Request.Form("name")  & vbcrlf
    JMail.Body = Jmail.body & "Telephone:       " & Request.Form("tel") & vbcrlf
    JMail.Body = Jmail.body & "Country of Origin:       " & Request.Form("Cou") & vbcrlf
    JMail.Body = Jmail.body & "Email:      " & Request.Form("email") & vbcrlf
    JMail.Body = Jmail.body & "Arrival Date:      " & Request.Form("arrival") & vbcrlf    
	JMail.Body = Jmail.body & "Stage:      " & Request.Form("stage") & vbcrlf  
	JMail.Body = Jmail.body & "Budget:      " & Request.Form("budget") & vbcrlf  
   If Request.Form("nights") <> "" Then
    	JMail.Body = Jmail.body & "Nights:      " & Request.Form("nights") & vbcrlf    
    End If
    If Request.Form("persons") <> "" Then
        JMail.Body = Jmail.body & "Persons:      " & Request.Form("persons") & vbcrlf    
    End If
    If Request.Form("rooms") <> "" Then
        JMail.Body = Jmail.body & "Rooms:      " & Request.Form("rooms") & vbcrlf    
    End If
    JMail.Body = JMail.Body & "Destination 1:   " & Request.Form("dest_1") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 2:   " & Request.Form("dest_2") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 3:   " & Request.Form("dest_3") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 4:   " & Request.Form("dest_4") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 5:   " & Request.Form("dest_5") & vbCrLf    
    JMail.Body = JMail.Body & "Extension:   " & Request.Form("extension") & vbCrLf    
    JMail.Body = Jmail.body & "Comments or Requests:   " & Request.Form("comments") & vbcrlf
    JMail.Priority = 1
    JMail.Execute
%>

<p align="center">
presentation stuff here
</p>

<!--this is where i'd like to add the content based on where they come from-->
<div id="content-landing">
<a href="<%= Request.Form("url") %>"><%= Request.Form("package") %></a>
</p>

more presentational stuff here
                              
        </body>
</html><% Response.end %>
 

Ap0ks

macrumors 6502
Aug 12, 2008
316
93
Cambridge, UK
Something like the below should help you get to what you want, providing the content won't be changing often. Note I don't have a server at hand to try this out on, so going from memory but it should give you the general idea ;)
Code:
<html>
<head>
<title>Confirmation </title>

<link href="../css/styles.css" rel="stylesheet" type="text/css" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body> 

<%
    Set JMail = Server.CreateObject("JMail.SMTPMail")
    JMail.ServerAddress = "localhost"
    JMail.ISOEncodeHeaders = False

    If Request.Form("email") = "" THEN
      JMail.Sender = "email@company.com"
    Else
      JMail.Sender = Request.Form("email")
    End If
    JMail.Subject = "AutoIT::" & Request.Form("package")
    JMail.AddRecipient "email@company.com"
    JMail.Body =  "Name:    " & Request.Form("name")  & vbcrlf
    JMail.Body = Jmail.body & "Telephone:       " & Request.Form("tel") & vbcrlf
    JMail.Body = Jmail.body & "Country of Origin:       " & Request.Form("Cou") & vbcrlf
    JMail.Body = Jmail.body & "Email:      " & Request.Form("email") & vbcrlf
    JMail.Body = Jmail.body & "Arrival Date:      " & Request.Form("arrival") & vbcrlf    
	JMail.Body = Jmail.body & "Stage:      " & Request.Form("stage") & vbcrlf  
	JMail.Body = Jmail.body & "Budget:      " & Request.Form("budget") & vbcrlf  
   If Request.Form("nights") <> "" Then
    	JMail.Body = Jmail.body & "Nights:      " & Request.Form("nights") & vbcrlf    
    End If
    If Request.Form("persons") <> "" Then
        JMail.Body = Jmail.body & "Persons:      " & Request.Form("persons") & vbcrlf    
    End If
    If Request.Form("rooms") <> "" Then
        JMail.Body = Jmail.body & "Rooms:      " & Request.Form("rooms") & vbcrlf    
    End If
    JMail.Body = JMail.Body & "Destination 1:   " & Request.Form("dest_1") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 2:   " & Request.Form("dest_2") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 3:   " & Request.Form("dest_3") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 4:   " & Request.Form("dest_4") & vbCrLf    
    JMail.Body = JMail.Body & "Destination 5:   " & Request.Form("dest_5") & vbCrLf    
    JMail.Body = JMail.Body & "Extension:   " & Request.Form("extension") & vbCrLf    
    JMail.Body = Jmail.body & "Comments or Requests:   " & Request.Form("comments") & vbcrlf
    JMail.Priority = 1
    JMail.Execute
%>

<p align="center">
presentation stuff here
</p>

<!--this is where i'd like to add the content based on where they come from-->
<% If Request.Form("url") == "http://somesite.com/vacation1.asp" Then %>
<!-- HTML for Vacation 1 content here -->
<p>Vacation 1 information!</p>
<% Else If Request.Form("url") == "http://somesite.com/vacation2.asp" Then %>
<!-- HTML for Vacation 2 content here -->
<p>Vacation 2 information!</p>
<% Else %>
<!-- HTML for when the URL isn't matched here -->
<p>Wrong URL - or check all vacations here...</p>
<% End If %>
<div id="content-landing">
<a href="<%= Request.Form("url") %>"><%= Request.Form("package") %></a>
</p>

more presentational stuff here
                              
        </body>
</html>
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.