Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 9, 2012, 09:20 AM   #1
sk3pt1c
macrumors 6502a
 
Join Date: Nov 2005
Location: a simulacrum
need help combining js with asp

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
__________________
Vi Veri Veniversum Vivus Vici
Macbook Pro 15" Retina
sk3pt1c is offline   0 Reply With Quote
Old Oct 9, 2012, 12:53 PM   #2
Darth.Titan
macrumors 68020
 
Darth.Titan's Avatar
 
Join Date: Oct 2007
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?
Darth.Titan is offline   0 Reply With Quote
Old Oct 11, 2012, 09:45 AM   #3
sk3pt1c
Thread Starter
macrumors 6502a
 
Join Date: Nov 2005
Location: a simulacrum
Quote:
Originally Posted by Darth.Titan View Post
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
__________________
Vi Veri Veniversum Vivus Vici
Macbook Pro 15" Retina
sk3pt1c is offline   0 Reply With Quote
Old Oct 15, 2012, 04:28 PM   #4
Ap0ks
macrumors regular
 
Join Date: Aug 2008
Location: 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?
Ap0ks is offline   0 Reply With Quote
Old Oct 16, 2012, 05:24 AM   #5
sk3pt1c
Thread Starter
macrumors 6502a
 
Join Date: Nov 2005
Location: a simulacrum
Quote:
Originally Posted by Ap0ks View Post
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 %>
__________________
Vi Veri Veniversum Vivus Vici
Macbook Pro 15" Retina
sk3pt1c is offline   0 Reply With Quote
Old Oct 16, 2012, 06:23 AM   #6
Ap0ks
macrumors regular
 
Join Date: Aug 2008
Location: 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>
Ap0ks is offline   0 Reply With Quote
Old Oct 16, 2012, 06:29 AM   #7
sk3pt1c
Thread Starter
macrumors 6502a
 
Join Date: Nov 2005
Location: a simulacrum
awesome, thank you!
__________________
Vi Veri Veniversum Vivus Vici
Macbook Pro 15" Retina
sk3pt1c is offline   0 Reply With Quote

Reply
MacRumors Forums > Special Interests > Visual Media > Web Design and Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Help with combining photos. hayden536 Web Design and Development 4 Nov 15, 2012 08:40 PM
ASIFormDataRequest submission for ASP.net form merrickdrfc iPhone/iPad Programming 3 Jul 19, 2012 08:42 AM

Forum Jump

All times are GMT -5. The time now is 01:39 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC