Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email This URL

Status
Not open for further replies.

MajorTechie

Programmer
Mar 20, 2002
30
CA
Hello,

I have an "Email this form" button happening.

I want the user to be able to fill in a form instead of popping up an email. So I've written an asp page to do the trick.

The JavaScript code I have to send the url to the form is:


<SCRIPT LANGUAGE=&quot;JavaScript1.2&quot;>
function mailThisURL() {
var Location = window.location;
var Page = &quot;../email.asp?URL=&quot; + Location;
NewWindow = window.open(Page, &quot;Email&quot;, &quot;location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=361,height=342&quot;);
}
</script>

Then I have a form that takes info from the user and passes the URL in a hidden field:

<%@ Language=VBScript %>
<%

Dim URL
URL = Request(&quot;URL&quot;)

~~~~~~~~~~~~~~

<input type=&quot;hidden&quot; name=&quot;URL&quot; value=&quot;<%=URL%>&quot;>
%>

The problem I have is in the third page which actually sends the info. Everything is sending fine but the URL.

<%@ Language=VBScript %>
<%

Dim URL, Content, SenderName, SenderEmail, RecipEmail, Comments, Subject, URL2, URL3

SenderName = Request(&quot;SenderName&quot;)
SenderEmail = Request(&quot;SenderEmail&quot;)
Subject = Request(&quot;Subject&quot;)
RecipEmail = Request(&quot;RecipEmail&quot;)
Comments = Request(&quot;Comm&quot;)
URL = Request(&quot;URL&quot;)

//this is because the URL is being passed in an encoded form
//so I need to decode it
URL2 = Replace(URL, &quot;%3A&quot;, &quot;:&quot;)
URL3 = Replace(URL2, &quot;%2F&quot;, &quot;/&quot;)
Content = URL3 + &quot;<p>&quot; + Comments

Set Mail = Server.CreateObject(&quot;Persits.MailSender&quot;)
Mail.Host = &quot;pop.*****.com&quot;
Mail.From = SenderEmail
Mail.FromName = SenderName
Mail.AddAddress RecipEmail
Mail.Subject = Subject
Mail.IsHTML = true
Mail.Body = Content
On Error Resume Next
Mail.Send
%>
 
change

var Page = &quot;../email.asp?URL=&quot; + Location
to
var Page = &quot;../email.asp?URL=&quot; + escape(Location)

URL = Request(&quot;URL&quot;)
URL = server.URLDecode(URL)
Content = URL + &quot;<p>&quot; + Comments
 
sjravee,

The last bit gives me an error. I replaced

URL2 = Replace(URL, &quot;%3A&quot;, &quot;:&quot;)
URL3 = Replace(URL2, &quot;%2F&quot;, &quot;/&quot;)
Content = URL3 + &quot;<p>&quot; + Comments

with

URL = Request(&quot;URL&quot;)
URL = server.URLDecode(URL)
Content = URL + &quot;<p>&quot; + Comments

I get:
Object doesn't support this property or method:
'server.URLDecode'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top