cmaorg
asked on
Send a friend a page url
Hello, it's me again.
I now have the script working fine however when I use a javascript popup window the link no longer shows in the e-mail that is sent. If I simple put a target=_blank then it works fine however I can't specify the dimensions of the popup window. Can you help me??? Here's the code:
<cfif #parameterexists(form.da_a ction)#>
<cfmail to="#email#" from="#from_email#" subject="Check This Site out" type="HTML">
<center>
<body text="##131313" link="##ff0000" vlink="##ff0000" alink="##ff0000">
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<tr>
<td bgcolor="##333333">
<table width="100%" border="0" cellpadding="0" cellspacing="10" bgcolor="##FFFFFF">
<tr>
<td width="96%">
<p><font style="font-family: Arial, Helvetica, sans-serif; font-size:13px; color:##131313;"><b>Hello, </b>
<p>
<strong>#from_name#</stron g> invites you to visit the following page on the <strong>Web site Name</strong> Web site:
<p><a href="#Form.da_action#">#F orm.da_act ion#</a></ p>
<p>
<strong>#from_name#</stron g> also sent you the following message:<p>
<p>#message#</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</center>
</cfmail>
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<tr>
<td bgcolor="#333333"><span style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color:#fff fff;font-w eight:bold ;">E-mail a Friend</span>
<table width="100%" height="200" border="0" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
<tr>
<td align="center"><span style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color:#131 313;font-w eight:bold ;">Your Email Has Been Sent.. Thank You</span></td>
</tr>
</table>
</td>
</tr>
</table>
<cfelse>
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<form method="post" action="">
<tr>
<td bgcolor="#333333"><span style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color:#fff fff;font-w eight:bold ;">E-mail a Friend</span>
<table width="100%" border="0" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
<tr>
<td><label for="from_name" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Your Name:</label>
<br>
<input type="Text" name="from_name"></td>
</tr>
<tr>
<td><label for="from_email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Your Email Address:</label>
<br>
<input type="Text" name="from_email"></td>
</tr>
<tr>
<td><label for="email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Friend's Email Address:</label>
<cfoutput>
<input type="hidden" name="da_action" value="#CGI.HTTP_REFERER#" >
</cfoutput>
<br>
<input type="Text" name="email"></td>
</tr>
<tr>
<td width="96%"><label for="message" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Message:< /label><br >
<textarea name="message" rows="5"></textarea>
</font></td>
</tr>
<tr>
<td><input name="submit" type="image" src="../images/bt_submit.g if" alt="Submit" /></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</cfif>
</body>
</html>
I now have the script working fine however when I use a javascript popup window the link no longer shows in the e-mail that is sent. If I simple put a target=_blank then it works fine however I can't specify the dimensions of the popup window. Can you help me??? Here's the code:
<cfif #parameterexists(form.da_a
<cfmail to="#email#" from="#from_email#" subject="Check This Site out" type="HTML">
<center>
<body text="##131313" link="##ff0000" vlink="##ff0000" alink="##ff0000">
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<tr>
<td bgcolor="##333333">
<table width="100%" border="0" cellpadding="0" cellspacing="10" bgcolor="##FFFFFF">
<tr>
<td width="96%">
<p><font style="font-family: Arial, Helvetica, sans-serif; font-size:13px; color:##131313;"><b>Hello,
<p>
<strong>#from_name#</stron
<p><a href="#Form.da_action#">#F
<p>
<strong>#from_name#</stron
<p>#message#</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</center>
</cfmail>
<body leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0">
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<tr>
<td bgcolor="#333333"><span style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<table width="100%" height="200" border="0" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
<tr>
<td align="center"><span style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
</tr>
</table>
</td>
</tr>
</table>
<cfelse>
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<form method="post" action="">
<tr>
<td bgcolor="#333333"><span style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<table width="100%" border="0" cellpadding="0" cellspacing="10" bgcolor="#FFFFFF">
<tr>
<td><label for="from_name" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<br>
<input type="Text" name="from_name"></td>
</tr>
<tr>
<td><label for="from_email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<br>
<input type="Text" name="from_email"></td>
</tr>
<tr>
<td><label for="email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<cfoutput>
<input type="hidden" name="da_action" value="#CGI.HTTP_REFERER#"
</cfoutput>
<br>
<input type="Text" name="email"></td>
</tr>
<tr>
<td width="96%"><label for="message" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<textarea name="message" rows="5"></textarea>
</font></td>
</tr>
<tr>
<td><input name="submit" type="image" src="../images/bt_submit.g
</tr>
</table>
</td>
</tr>
</form>
</table>
</cfif>
</body>
</html>
ASKER
I have tried using the Javascript popup however when I do the e-mail that is sent no longer sends the referring link. Here's the code that I am using:
<a href="tools/sendfriend.cfm " onclick="window.open('tool s/sendfrie nd.cfm','p opup','wid th=500,hei ght=500,sc rollbars=n o,resizabl e=no,toolb ar=no,dire ctories=no ,location= no,menubar =no,status =no,left=0 ,top=0'); return false">test</a>
Please help!!!
cmaorg
<a href="tools/sendfriend.cfm
Please help!!!
cmaorg
It is very strange that you have the link go to the page and it open in a pop-up onclick of the link.
Any reason to be doing this?
Any reason to be doing this?
ASKER
This is a pop up script that I found on the internet. No matter which pop up script I use it doesn't retain the referrer address when the window opens...thus the URL is not being sent when the e-mail is sent. If I use a regular link with a target=_blank then the script works no problem however I am unable to size the window how I would like it to be sized. What am I doing wrong and why isn't the URL being passed to the form.da_action when I use a popup script?
Help!!!
Help!!!
Again why are you opening the page in a separate window and the current window?
The code doesn't make sense to be doing it that way.
The code doesn't make sense to be doing it that way.
ASKER
How should I be doing it then? I want to use a popup that will retain the referrer address when the link is clicked.
Thanks
Thanks
Can you explain the purpose of the popup - it is very difficult to help without understanding what you are trying to do.
ASKER
I have the script that e-mails the URL of a page to a friend. It is working fine however when I use a javascript popup window the referring URL no longer shows in the e-mail that is sent. If I simple put a target=_blank then it works fine however I can't specify the dimensions of the popup window. I would like to use a pop up window...what am I doing wrong? I have included the code in my first help message.
Thanks
Thanks
Okay I still am having trouble understanding.
Maybe the problem is that I don't understand what you mean by:
I have tried using the Javascript popup however when I do the e-mail that is sent no longer sends the referring link
What is the referring link? the page itself or the page it comes from? Maybe you should send the link you want into the email page.
Can you show the mail code?
Maybe the problem is that I don't understand what you mean by:
I have tried using the Javascript popup however when I do the e-mail that is sent no longer sends the referring link
What is the referring link? the page itself or the page it comes from? Maybe you should send the link you want into the email page.
Can you show the mail code?
ASKER
The complete code is in my initial request.
Well in that code you access form variables which means you post the form which means you CANNOT have it open in a pop-up via clicking a link as the form needs to post to get those variables.
I think you need to re-evaluate what you are doing.
Also I still do not see what you mean by referring link.
I think you need to re-evaluate what you are doing.
Also I still do not see what you mean by referring link.
ASKER
What is necessary for me get a user to be able to click a link, get a pop up window and have the link of the page that they were just on sent to a friend? A referring link is the initial page that the user was on when they clicked the link to e-mail the page to a friend.
Why is it that the form works fine when I use a link and a "target=_blank" then?
Why is it that the form works fine when I use a link and a "target=_blank" then?
The reason the email is not sending is this line:
<cfif #parameterexists(form.da_a ction)#>
form.da_action does not exist since you are clicking a link, but looking at a form variable.
It works otherwise because you have a submit button which submits the form so the variable (parameter) is present and so the message sends.
<cfif #parameterexists(form.da_a
form.da_action does not exist since you are clicking a link, but looking at a form variable.
It works otherwise because you have a submit button which submits the form so the variable (parameter) is present and so the message sends.
ASKER
So what should I do? If I remove that line will it work with the popup javascript and still send the referring URL?
Nope.
You need to reevaluate the logic of how you are doing this.
If you want to do it in a pop-up then you need to send the URL that you want to "send to a friend" to the pop-up via some other method.
Like a URL variable
You need to reevaluate the logic of how you are doing this.
If you want to do it in a pop-up then you need to send the URL that you want to "send to a friend" to the pop-up via some other method.
Like a URL variable
ASKER
How do I do that?
It involves chaning the form from POST to GET , then include the URL prefix instead of FORM, then send the URL variable into the pop-up window.
The best method is really as I mentioned to reevaluate your whole logic. You probably don't want this whole thing as the same page since you want part in the browser and part in the pop-up.
The best method is really as I mentioned to reevaluate your whole logic. You probably don't want this whole thing as the same page since you want part in the browser and part in the pop-up.
ASKER
I am new to Coldfusion...therefore can you point me somewhere where I can learn how to do this? Could you possibly send provide me with the code that would need changing?
Thanks so much
Thanks so much
I would rewrite to something like the following. What happens is the user fills out the form. The email is sent and a confirmation displayed.
emailfriend.cfm
---------------------
<html>
<body>
<div style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color:#fff fff;font-w eight:bold ;">E-mail a Friend</div>
<form method="post" action="processemail.cfm">
<p><label for="from_name" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Your Name:</label><br>
<input type="Text" name="from_name"></p>
<p><label for="from_email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Your Email Address:</label><br>
<input type="Text" name="from_email"></p>
<p><label for="email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Friend's Email Address:</label><br>
<input type="Text" name="email"></p>
<input type="hidden" name="da_action" value=" <cfoutput>#CGI.HTTP_REFERE R#</cfoutp ut>">
<p><label for="message" style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color: #131313;font-weight:bold;" >Message:< /label><br >
<textarea name="message" rows="5"></textarea></p>
<input name="submit" type="submit" value="Submit">
</form>
</body>
</html>
processemail.cfm
-------------------------- --
<cfif IsDefined("Form.Submit")>
<cfmail to="#email#" from="#from_email#" subject="Check This Site out" type="HTML">
<center>
<body text="##131313" link="##ff0000" vlink="##ff0000" alink="##ff0000">
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<tr>
<td bgcolor="##333333">
<table width="100%" border="0" cellpadding="0" cellspacing="10" bgcolor="##FFFFFF">
<tr>
<td width="96%">
<p><font style="font-family: Arial, Helvetica, sans-serif; font-size:13px; color:##131313;"><b>Hello, </b>
<p>
<strong>#from_name#</stron g> invites you to visit the following page on the <strong>Web site Name</strong> Web site:
<p><a href="#Form.da_action#">#F orm.da_act ion#</a></ p>
<p>
<strong>#from_name#</stron g> also sent you the following message:<p>
<p>#message#</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</center>
</cfmail>
<cfelse>
<cflocation url="emailfriend.cfm">
</cfif>
<html>
<body>
<span style="font-family: Arial, Helvetica, sans-serif;font-size:11px; color:#131 313;font-w eight:bold ;">Your Email Has Been Sent.. Thank You</span>
</body>
</html>
As for showing up in a pop-up I still don't understand the purpose - what is on the actual page the pop-up is called from then?
emailfriend.cfm
---------------------
<html>
<body>
<div style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<form method="post" action="processemail.cfm">
<p><label for="from_name" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<input type="Text" name="from_name"></p>
<p><label for="from_email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<input type="Text" name="from_email"></p>
<p><label for="email" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<input type="Text" name="email"></p>
<input type="hidden" name="da_action" value=" <cfoutput>#CGI.HTTP_REFERE
<p><label for="message" style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
<textarea name="message" rows="5"></textarea></p>
<input name="submit" type="submit" value="Submit">
</form>
</body>
</html>
processemail.cfm
--------------------------
<cfif IsDefined("Form.Submit")>
<cfmail to="#email#" from="#from_email#" subject="Check This Site out" type="HTML">
<center>
<body text="##131313" link="##ff0000" vlink="##ff0000" alink="##ff0000">
<table width="100%" border="0" cellspacing="5" cellpadding="8">
<tr>
<td bgcolor="##333333">
<table width="100%" border="0" cellpadding="0" cellspacing="10" bgcolor="##FFFFFF">
<tr>
<td width="96%">
<p><font style="font-family: Arial, Helvetica, sans-serif; font-size:13px; color:##131313;"><b>Hello,
<p>
<strong>#from_name#</stron
<p><a href="#Form.da_action#">#F
<p>
<strong>#from_name#</stron
<p>#message#</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</center>
</cfmail>
<cfelse>
<cflocation url="emailfriend.cfm">
</cfif>
<html>
<body>
<span style="font-family: Arial, Helvetica, sans-serif;font-size:11px;
</body>
</html>
As for showing up in a pop-up I still don't understand the purpose - what is on the actual page the pop-up is called from then?
ASKER
Thanks mrichmon, I will try your code today.
As for the reason for the pop up. I am sure that you have been to a Web site that has a link to a e-mail a friend from a page that contains an article let's say, that opens up in a pop up window. You fill out the form with your friend's e-mail address and the e-mail is sent with the article's name and URL. I would like to do this as well rather than have the code on every page of my site. This is the reason for the pop up.
As for the reason for the pop up. I am sure that you have been to a Web site that has a link to a e-mail a friend from a page that contains an article let's say, that opens up in a pop up window. You fill out the form with your friend's e-mail address and the e-mail is sent with the article's name and URL. I would like to do this as well rather than have the code on every page of my site. This is the reason for the pop up.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect...I will try that today.
ASKER
Thank you, thank you, thank you!!! You have been a huge help! Thanks so much...it worked perfectly. The window pops up just the way I want it to.
cmaorg
cmaorg
ASKER
It's me again...when I use the javascript pop up...the link of the page does not show in the e-mail. HELP!!!
I think the biggest problem is that you are using CGI.HTTP_REFERER
which does not always have a value.
You could do something like this:
<a href="javascript:window.op en('emailf riend.cfm? sendtofrie ndurl=#CGI .SCRIPT_NA ME#','titl e','height =100,width =200');">C lick here to email this page to a friend</a>
ANd then accesss #URL.sendtofriendurl#
so that you use something besides HTTP_REFERER.
CGI.HTTP_REFERER jsut doesn't work consistently
which does not always have a value.
You could do something like this:
<a href="javascript:window.op
ANd then accesss #URL.sendtofriendurl#
so that you use something besides HTTP_REFERER.
CGI.HTTP_REFERER jsut doesn't work consistently
ASKER
You are the best! It works perfectly now!!!
Thanks so much again.
cmaorg
Thanks so much again.
cmaorg
ASKER
One last question...when I use a graphic submit button instead of the reguler submit button I get an error. However when I replace the coded button the script works fine. Does it have to do with this code at the beginning of the processemail.cfm page "<cfif IsDefined("Form.Submit")>" ? How do I change it so that it will allow me to use an image as a submit button???
>>Does it have to do with this code at the beginning of the processemail.cfm page "<cfif IsDefined("Form.Submit")>" ?
Yes it does.
>> How do I change it so that it will allow me to use an image as a submit button???
You have to check for something that indicates the form was submitted. If you always have the <input type="Text" name="email"> defined then try
<cfif IsDefined("Form.Email")>
Yes it does.
>> How do I change it so that it will allow me to use an image as a submit button???
You have to check for something that indicates the form was submitted. If you always have the <input type="Text" name="email"> defined then try
<cfif IsDefined("Form.Email")>
ASKER
That worked perfectly!!! Thanks a billion.
You may want to consider window.open which allows dimensions to be specified
window.open('display.html'
http://www.devguru.com/Technologies/ecmascript/quickref/win_open.html