Link to home
Start Free TrialLog in
Avatar of jcperez2000
jcperez2000

asked on

Need Help WIth "SEND A LINK" Script!

A user from coldfusion-howto group in yahoo shared this with and I can't get a hold of him to help me getting it to work.  Can someone help me getting it to work by <--REMARKING--> it as much as possible? (The most advance aspects of the code i.e function isValidemail and so on--I understands HTML)

Sendlink.CFM > EMAILLINK.CFM to open in a new browser window is fine. The REAL problem, evidently is in the javcode because the "CLICK HERE TO SEND" link does not process.

Thank You,

Charlie Perez

==============

<--EMAILLINK.CFM--> From the Sendlink.CFM file I can get EMAILLINK.CFM to open in a new browser window.

<head>
<title>Email This To Your Friends!</title>
</head>
<form name="wmForm" method=post action="mailit.cfm">
  <TABLE width="468" border="0" cellspacing="0" cellpadding="0">
    <script language="JavaScript">

function isValidEmail(email) {
      if (email=="") {
            return false;
      }
      if (email.indexOf('@')<1) {
            return false;
      }
      if (email.indexOf('.')==-1) {
            return false;
      }
      if (email.indexOf('.')==(email.length -1)) {
            return false;
      }
      if (email.indexOf('.')==(email.indexOf('@')+1)) {
            return false;
      }
      return true;
}

var errorVals = new Array();
errorVals[0] ="You must enter a valid email address in the Your Email
Address field";
errorVals[1] ="You must enter a valid email address in the To field";

function wmverify() {
      if (!isValidEmail(document.wmForm.wmMail.value)) {
            alert(errorVals[0]);
            return false;
      }
      if (document.wmForm.wmTo.value == "") {
            alert(errorVals[1]);
            return false;
      }
      return true;
}
</script>

    <CFOUTPUT>
    <INPUT TYPE="hidden" NAME="wmURL" value="#lurl#"></CFOUTPUT>
      <body>
    <TR>
      <TD></TD>
     
  <TD><font size="7">Email This Page</font></TD>
</TR>
<TR>
      <TD>&nbsp;</TD>
     
  <TD ><CFOUTPUT>
      <div align="center"><br>
        <font size="2" face="Arial, Helvetica, sans-serif">Fill out the form below
        and we'll send a personalized email from you to a friend or colleague
        about: </font><br>
        <font
color="cc0000">#title#</font>.</div>
    </CFOUTPUT> </TD>
</TR>
<TR>
  <TD>&nbsp;</TD>
      <TD>
        <TABLE border="0" cellspacing="0" cellpadding="1" width="41%">
      <TR>
           
        <TD height="292" colspan="2">
          <TABLE width="340" border="0" cellpadding="3" cellspacing="0">
            <TR>
                 
              <TD width="109" valign="top"><b><font size="2" face="Arial, Helvetica, sans-serif">Friend's
                </font></b><font size="2" face="Arial, Helvetica, sans-serif"><b>
                Email:</b></font><b> </b></TD>
                 
              <TD width="219" valign="top">
                <p>
                  <INPUT TYPE="text" NAME="wmTo" SIZE="22" value="">
                  <font color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">(required)</font><font color="#FF0000"><br>
                  </font></p>
                </TD>
                </tr>
                <TR>
                 
              <TD><b><font size="2" face="Arial, Helvetica, sans-serif">Your Name:</font></b></TD>
                  <TD>
                    <INPUT TYPE="text"  NAME="wmFrom" SIZE="22" value="">
                  </TD>
                </TR>
                <TR>
                 
              <TD valign="top"><b><font size="2" face="Arial, Helvetica, sans-serif">Your
                Email</font></b>:<br>
              </TD>
                 
              <TD valign="top">
                <INPUT TYPE="text" NAME="wmMail" SIZE="22" value="">
                <font color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">(required) </font></TD>
                </TR>
                <TR>
                  <TD colspan="2"><font size="1" face="Arial, Helvetica, sans-serif">Your email address is only
used
                    so that your friend can conveniently reply. <br>
                    We <b><u>never</u></b> add email addresses to our
mailing
                    lists without your permission.</font></TD>
                </TR>
                <TR>
                 
              <TD><font size="2" face="Arial, Helvetica, sans-serif">Subject:</font></TD>
                  <TD><CFOUTPUT>
                      <INPUT TYPE="text"  NAME="wmSubject" SIZE="42"
value="#title#">
                    </CFOUTPUT>
                  </TD>
                </TR>
                <TR>
                 
              <TD colspan="2"><font size="2" face="Arial, Helvetica, sans-serif"><strong>Message:</strong></font></TD>
                </TR>
                <TR>
                  <TD COLSPAN="2" VALIGN="TOP">
                    <TEXTAREA NAME="wmBody" rows="6" cols="50"></TEXTAREA>
                  </TD>
                </TR>
              </TABLE>
            </TD>
          </TR>
        </TABLE>
      </TD>
    </TR>
    <TR>
      <TD>&nbsp;</TD>
      <TD><a
href="javascript:document.wmForm.clickMap.value='sendEmail';document.wmForm.
send.value=1;document.wmForm.submit();" onclick="return(wmverify());"><font
size="4">Click
        here to send</font></a></TD>
    </TR>
  </TABLE>

</FORM>
  </body>


  ----------

<--SENDLINK.CFM--> I CAN HANDLE THIS ONE...!
<html>
<head>
<title>FAIRTAX NEWS EXAMPLE ARTICLE</title>
</head>

<body>
<p><a
href="javascript:void(open('http://192.168.1.15/SendLink/emaillink.cfm?&lurl=
'+escape(location.href)+'&amp;title='+escape(document.title),'click','height
=460,width=510,title=yes,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no'))">Send A Link</a></p>
<p>INSTRUCTION TO INSTALL SEND A LINK.</p>
<p>&nbsp;</p>
</body>
</html>
  ----------

<--MAILIT.CFM-->

<HEAD>
<CFPARAM name="wmFrom" DEFAULT="">
<CFPARAM name="wmSubject" DEFAULT="FairTaxUsa.Org News">
<CFPARAM name="wmBody" DEFAULT=" ">
<CFPARAM name="wmMail" DEFAULT=" ">
<CFPARAM name="wmURL" DEFAULT=" ">

<CFMAIL FROM="News@FairTaxUsa.Org"
        TO="#wmTo#"
        BCC="admin@fairtaxusa.org"
        SUBJECT="A suggested website (#wmSubject#) from #wmFrom#"
            SERVER="http://MyServer/SendLink">

Your friend #wmFrom# (#wmMail#) wanted you to know about this website:

#wmURL#

Here's what they had to say about it:
===========================================================
#wmBody#
===========================================================

Be sure to visit soon!
Avatar of anandkp
anandkp
Flag of India image

if its just that link thats not working - then tis b'cos u dont have those elemets on ur page

repalce the code with this one & tell me what happens

<HEAD>
<TITLE>Email This To Your Friends!</TITLE>
</HEAD>
<FORM name="wmForm" method="post" action="mailit.cfm">
      <TABLE width="468" border="0" cellspacing="0" cellpadding="0">
<SCRIPT language="JavaScript">
function isValidEmail(email) {
     if (email=="") {
          return false;
     }
     if (email.indexOf('@')<1) {
          return false;
     }
     if (email.indexOf('.')==-1) {
          return false;
     }
     if (email.indexOf('.')==(email.length -1)) {
          return false;
     }
     if (email.indexOf('.')==(email.indexOf('@')+1)) {
          return false;
     }
     return true;
}

var errorVals = new Array();
errorVals[0] ="You must enter a valid email address in the Your Email
Address field";
errorVals[1] ="You must enter a valid email address in the To field";

function wmverify() {
     if (!isValidEmail(document.wmForm.wmMail.value)) {
          alert(errorVals[0]);
          return false;
     }
     if (document.wmForm.wmTo.value == "") {
          alert(errorVals[1]);
          return false;
     }
     return true;
}
</SCRIPT>
            <CFOUTPUT>
                  <INPUT TYPE="hidden" NAME="wmURL" value="#lurl#">
            </CFOUTPUT>
<BODY>
            <TR>
                  <TD></TD>
                  <TD><FONT size="7">Email This Page</FONT></TD>
            </TR>
            <TR>
                  <TD>&nbsp;</TD>
                  <TD >
                  <CFOUTPUT>
                        <DIV align="center"><BR><FONT size="2" face="Arial, Helvetica, sans-serif">Fill out the form below
       and we'll send a personalized email from you to a friend or colleague
       about:</FONT><BR><FONT color="cc0000">#title#</FONT>.
                        </DIV>
                  </CFOUTPUT>
</TD>
            </TR>
            <TR>
                  <TD>&nbsp;</TD>
                  <TD>
                  <TABLE border="0" cellspacing="0" cellpadding="1" width="41%">
                        <TR>
                              <TD height="292" colspan="2">
                              <TABLE width="340" border="0" cellpadding="3" cellspacing="0">
                                    <TR>
                                          <TD width="109" valign="top"><B><FONT size="2" face="Arial, Helvetica, sans-serif">Friend's</FONT></B><FONT size="2" face="Arial, Helvetica, sans-serif"><B>Email:</B></FONT><B></B></TD>
                                          <TD width="219" valign="top">
<P>
                                          <INPUT TYPE="text" NAME="wmTo" SIZE="22" value=""><FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">(required)</FONT><FONT color="#FF0000"><BR></FONT></P></TD>
                                    </TR>
                                    <TR>
                                          <TD><B><FONT size="2" face="Arial, Helvetica, sans-serif">Your Name:</FONT></B></TD>
                                          <TD>
                                          <INPUT TYPE="text" NAME="wmFrom" SIZE="22" value=""></TD>
                                    </TR>
                                    <TR>
                                          <TD valign="top"><B><FONT size="2" face="Arial, Helvetica, sans-serif">Your
               Email</FONT></B>:<BR></TD>
                                          <TD valign="top">
                                          <INPUT TYPE="text" NAME="wmMail" SIZE="22" value=""><FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">(required)</FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD colspan="2"><FONT size="1" face="Arial, Helvetica, sans-serif">Your email address is only
used
                   so that your friend can conveniently reply.<BR>We<B><U>never</U></B>add email addresses to our
mailing
                   lists without your permission.</FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD><FONT size="2" face="Arial, Helvetica, sans-serif">Subject:</FONT></TD>
                                          <TD>
                                          <CFOUTPUT>
                                                <INPUT TYPE="text" NAME="wmSubject" SIZE="42" value="#title#">
                                <INPUT TYPE="hidden" NAME="clickMap" SIZE="42">
                                <INPUT TYPE="hidden" NAME="send" SIZE="42">
                                          </CFOUTPUT>
</TD>
                                    </TR>
                                    <TR>
                                          <TD colspan="2"><FONT size="2" face="Arial, Helvetica, sans-serif"><STRONG>Message:</STRONG></FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD COLSPAN="2" VALIGN="TOP">
                                          <TEXTAREA NAME="wmBody" rows="6" cols="50"></TEXTAREA></TD>
                                    </TR>
                              </TABLE></TD>
                        </TR>
                  </TABLE></TD>
            </TR>
            <TR>
                  <TD>&nbsp;</TD>
                  <TD><A href="javascript:document.wmForm.clickMap.value='sendEmail';document.wmForm.
send.value=1;document.wmForm.submit();" onClick="return(wmverify());"><FONT size="4">Click
       here to send</FONT></A></TD>
            </TR>
      </TABLE>
</FORM>
</BODY>

K'Rgds
Anand
Avatar of jcperez2000
jcperez2000

ASKER

OK, The confirmation window comes up, but we have another problem.  No email gets sent out.  Can you help me to cure this problem?  

I noticed on the code "="javascript:document.wmForm.clickMap.value='sendEmail';document.wmForm...."

WHat is the sendEmail.  I'm using the coldfusion server and there aren't any CDMAIL tags....

Thank You.
the code is just assigning a value "sendmail" to one of the controls on the form

may be this is getting evaluated in the next page ...

chk ur code in "mailit.cfm" the sending of mail takes place in that file

let me know

K'Rgds
Anand
I just tested the CF Server with a SendNewsletter file and CF is looking at my SMPT server...(Local SMTP Relay Server)

I looked and mailit.cfm but as I mentioned, I'm just getting started with CF... Here's the code for MAILIT.CFM don't know if perhaps you can find something wrong with it..Thanks


<HEAD>
<CFPARAM name="wmFrom" DEFAULT="">
<CFPARAM name="wmSubject" DEFAULT="FairTaxUsa.Org News">
<CFPARAM name="wmBody" DEFAULT=" ">
<CFPARAM name="wmMail" DEFAULT=" ">
<CFPARAM name="wmURL" DEFAULT=" ">

<CFMAIL FROM="News@FairTaxUsa.Org"
        TO="#wmTo#"
        BCC="admin@fairtaxusa.org"
        SUBJECT="A suggested website (#wmSubject#) from #wmFrom#"
          SERVER="http://192.168.1.15/SendLink">

Your friend #wmFrom# (#wmMail#) wanted you to know about this website:

#wmURL#

Here's what they had to say about it:
===========================================================
#wmBody#
===========================================================

Be sure to visit soon!

This message was generated by the URL referral service at yoursite.com.
If you received this message in error, please contact <a
href="mailto:#wmMail#">#wmMail#</a> or the
webmaster at http://www.fairtaxusa.org

</CFMAIL>
-->


</HEAD>

<BODY>
  <TABLE width="468" border="0" cellspacing="0" cellpadding="0">
    <TR>
      <TD ></TD>
      <TD>Your email has
        been sent!</TD>
    </TR>
    <TR>
      <TD>&nbsp;</TD>
      <TD> Thanks for using our email service! <br>
        Look for the link on all kinds of pages at <b>yoursite.com</b>!</TD>
    </TR>
    <TR>
      <TD>&nbsp;</TD>
      <TD>
        <TABLE width="100%" border="0" cellspacing="0" cellpadding="1">
          <TR>
            <TD><CFOUTPUT>
              <TABLE border="0" cellspacing="0" cellpadding="1">
                <TR>
                  <TD>To:</TD>
                  <TD> #wmTo# </TD>
                  <TD>&nbsp;</TD>
                </tr>
                <TR>
                  <TD>From::</TD>
                  <TD> #wmFrom#</TD>
                  <TD>&nbsp;</TD>
                </TR>
                <TR>
                  <TD colspan="3"><IMG src="images/bump.gif" width="2"
height="5"></TD>
                </TR>
                <TR>
                  <TD>Subject:</TD>
                  <TD> #wmSubject# </TD>
                  <TD>&nbsp;</TD>
                </TR>
                <TR>
                  <TD colspan="3"><IMG src="images/bump.gif" width="2"
height="5"></TD>
                </TR>
                <TR>
                  <TD>Your email<br>
                    address:</TD>
                  <TD nowrap> #wmMail#</TD>
                  <TD>&nbsp;</TD>
                </TR>
                <TR>
                  <TD colspan="3"><IMG src="images/bump.gif" width="2"
height="5"></TD>
                </TR>
                <TR>
                  <TD colspan="3">Message:</TD>
                </TR>
                <TR>
                  <TD COLSPAN="2" VALIGN="TOP"> #wmBody#</TD>
                  <TD>&nbsp;</TD>
                </TR>
              </TABLE></CFOUTPUT>
            </TD>
          </TR>
        </TABLE>
      </TD>
    </TR>
    <TR>
      <TD width="13">&nbsp;</TD>
      <TD width="455"><font size="4"><a
href="javascript:window.close();">Click
        here to return to the site</a></font></TD>
    </TR>
  </TABLE>

OK, The confirmation window comes up, but we have another problem.  No email gets sent out.  Can you help me to cure this problem?  

I noticed on the code "="javascript:document.wmForm.clickMap.value='sendEmail';document.wmForm...."

WHat is the sendEmail.  I'm using the coldfusion server and there aren't any CDMAIL tags....

Thank You.
u have a problem with ur EMAILSERVER IP !

chk up the mailserver ip address with ur system admin & that shld do it for u

let me know

K'Rgds
Anand
Do you know someone that could help me to troubleshoot my Exchange Server to find out why CF is not sending the messages.

The mail.log files
gives a 550 Relaying Deneied error.  So I know CF if is function properly.

As best as I've been able to troubleshoot, my relay settings are correct.

I posted a help request on this site for an Exchange Expert but I have not receive a response yet...

Any pointers will be greatly appreciated..

Charlie Perez
I dont have much info abt the exchnage servers - but wld try & get in touch with my sysadmin & see if i can help u out on this

K'Rgds
Anand
Thnak You
Just as I finally got it to work, Now it is stopping after"Click to Send" And CF returns and errors sayin that "title" is undefined.

Any suggestions....?  Thank you.

Charlie Perez
I was great to see it working for a few times.  I even fixed the Exchange Issues.  Here is the ERROR. I checked the syntax for FROM in CFMAIL and it seems to be fine.

Thanks Again.

Variable TITLE is undefined.  
 
 
The Error Occurred in C:\InetPub\wwwroot\SendLink\mailit.cfm: line 8
 
6 : <CFPARAM name="wmURL" DEFAULT=" ">
7 :
8 : <CFMAIL FROM="charlie@fairtaxusa.org"
9 :         TO="#wmTo#"
10 :         BCC="charlie@heloc.net"

 

--------------------------------------------------------------------------------
 
Please Try The Following:

Check the CFML Reference Manual to verify that you are using the correct syntax.

Search the Knowledge Base to find a solution to your problem.

 
Browser   Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
Remote Address   192.168.1.10
Referer   http://192.168.1.15/SendLink/emaillink.cfm?&lurl=http%3A//192.168.1.15/SendLink/Sendlink.htm&title=FairTaxUsa%20News%20Example 
Date/Time   19-Mar-03 05:24 PM
 
Stack Trace (click to expand)  
at cfmailit2ecfm1815743916.runPage(C:\InetPub\wwwroot\SendLink\mailit.cfm:8)


coldfusion.runtime.UndefinedVariableException: Variable TITLE is undefined.
     at coldfusion.runtime.CfJspPage._get(Unknown Source)
     at coldfusion.runtime.CfJspPage._autoscalarize(Unknown Source)
     at cfmailit2ecfm1815743916.runPage(C:\InetPub\wwwroot\SendLink\mailit.cfm:8)
     at coldfusion.runtime.CfJspPage.invoke(Unknown Source)
     at coldfusion.tagext.lang.IncludeTag.doStartTag(Unknown Source)
     at coldfusion.filter.CfincludeFilter.invoke(Unknown Source)
     at coldfusion.filter.ApplicationFilter.invoke(Unknown Source)
     at coldfusion.filter.PathFilter.invoke(Unknown Source)
     at coldfusion.filter.ExceptionFilter.invoke(Unknown Source)
     at coldfusion.filter.ClientScopePersistenceFilter.invoke(Unknown Source)
     at coldfusion.filter.BrowserFilter.invoke(Unknown Source)
     at coldfusion.filter.GlobalsFilter.invoke(Unknown Source)
     at coldfusion.filter.DatasourceFilter.invoke(Unknown Source)
     at coldfusion.CfmServlet.service(Unknown Source)
     at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
     at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
     at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:241)
     at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
     at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:198)
     at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348)
     at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451)
     at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294)
     at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

 
Here are the action page and the mailit.cfm page and the sendlink.cfm. (I did change the title of the sendlink) Don't know if that has anythinkg to do with the problem..

Thank You.

<--emaillink.cfm-->
<HEAD>
<TITLE>Email This To Your Friends!</TITLE>
</HEAD>
<FORM name="wmForm" method="post" action="mailit.cfm">
     <TABLE width="468" border="0" cellspacing="0" cellpadding="0">
<SCRIPT language="JavaScript">
function isValidEmail(email) {
    if (email=="") {
         return false;
    }
    if (email.indexOf('@')<1) {
         return false;
    }
    if (email.indexOf('.')==-1) {
         return false;
    }
    if (email.indexOf('.')==(email.length -1)) {
         return false;
    }
    if (email.indexOf('.')==(email.indexOf('@')+1)) {
         return false;
    }
    return true;
}

var errorVals = new Array();
errorVals[0] ="You must enter a valid email address in the Your Email
Address field";
errorVals[1] ="You must enter a valid email address in the To field";

function wmverify() {
    if (!isValidEmail(document.wmForm.wmMail.value)) {
         alert(errorVals[0]);
         return false;
    }
    if (document.wmForm.wmTo.value == "") {
         alert(errorVals[1]);
         return false;
    }
    return true;
}
</SCRIPT>
          <CFOUTPUT>
               <INPUT TYPE="hidden" NAME="wmURL" value="#lurl#">
              </CFOUTPUT>
<BODY>
          <TR>
               <TD></TD>
               <TD><FONT size="7">Email This Page</FONT></TD>
          </TR>
          <TR>
               <TD>&nbsp;</TD>
               <TD >
               <CFOUTPUT>
                    <DIV align="center"><BR><FONT size="2" face="Arial, Helvetica, sans-serif">Fill out the form below
      and we'll send a personalized email from you to a friend or colleague
      about:</FONT><BR><FONT color="cc0000">#title#</FONT>.
                    </DIV>
               </CFOUTPUT>
</TD>
          </TR>
          <TR>
               <TD>&nbsp;</TD>
               <TD>
               <TABLE border="0" cellspacing="0" cellpadding="1" width="41%">
                    <TR>
                         <TD height="292" colspan="2">
                         <TABLE width="340" border="0" cellpadding="3" cellspacing="0">
                              <TR>
                                   
              <TD width="109" valign="top"><B><FONT size="2" face="Arial, Helvetica, sans-serif">Friend's
                </FONT></B><FONT size="2" face="Arial, Helvetica, sans-serif"><B>Email:</B></FONT><B></B></TD>
                                   <TD width="219" valign="top">
<P>
                                   <INPUT TYPE="text" NAME="wmTo" SIZE="22" value=""><FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">(required)</FONT><FONT color="#FF0000"><BR></FONT></P></TD>
                              </TR>
                              <TR>
                                   <TD><B><FONT size="2" face="Arial, Helvetica, sans-serif">Your Name:</FONT></B></TD>
                                   <TD>
                                   <INPUT TYPE="text" NAME="wmFrom" SIZE="22" value=""></TD>
                              </TR>
                              <TR>
                                   <TD valign="top"><B><FONT size="2" face="Arial, Helvetica, sans-serif">Your
              Email</FONT></B>:<BR></TD>
                                   <TD valign="top">
                                   <INPUT TYPE="text" NAME="wmMail" SIZE="22" value=""><FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">(required)</FONT></TD>
                              </TR>
                              <TR>
                                   <TD colspan="2"><div align="center"><FONT size="1" face="Arial, Helvetica, sans-serif">Your
                  email address is only used so that your friend can conveniently
                  reply.<BR>
                  We <B><U>NEVER</U></B> add email addresses to our mailing lists
                  without your permission.</FONT></div></TD>
                              </TR>
                              <TR>
                                   <TD><FONT size="2" face="Arial, Helvetica, sans-serif">Subject:</FONT></TD>
                                   <TD>
                                   <CFOUTPUT>
                                        <INPUT TYPE="text" NAME="wmSubject" SIZE="42" value="#title#">
                               <INPUT TYPE="hidden" NAME="clickMap" SIZE="42">
                               <INPUT TYPE="hidden" NAME="send" SIZE="42">
                                   </CFOUTPUT>
</TD>
                              </TR>
                              <TR>
                                   <TD colspan="2"><FONT size="2" face="Arial, Helvetica, sans-serif"><STRONG>Message:</STRONG></FONT></TD>
                              </TR>
                              <TR>
                                   <TD COLSPAN="2" VALIGN="TOP">
                                   <TEXTAREA NAME="wmBody" rows="6" cols="50"></TEXTAREA></TD>
                              </TR>
                         </TABLE></TD>
                    </TR>
               </TABLE></TD>
          </TR>
          <TR>
               <TD>&nbsp;</TD>
               <TD><A href="javascript:document.wmForm.clickMap.value='sendEmail';document.wmForm.
send.value=1;document.wmForm.submit();" onClick="return(wmverify());"><FONT size="4">Click
      here to send</FONT></A></TD>
          </TR>
     </TABLE>
</FORM>
</BODY>

<--mailit.cfm-->

<HEAD>
<CFPARAM name="wmFrom" DEFAULT="">
<CFPARAM name="wmSubject" DEFAULT=" ">
<CFPARAM name="wmBody" DEFAULT=" ">
<CFPARAM name="wmMail" DEFAULT=" ">
<CFPARAM name="wmURL" DEFAULT=" ">

<CFMAIL FROM="charlie@fairtaxusa.org"
        TO="#wmTo#"
        BCC="charlie@heloc.net"
        SUBJECT="A suggested website #title# from #wmFrom#">
  Your friend #wmFrom#, (#wmMail#) wanted you to know about this website:

  #wmURL#
 
  Here's what #wmFrom# had to say about it:
  ===========================================================
  #wmBody#
  ===========================================================
 
  Be sure to visit soon! This message was generated by the URL referral service
  at FairTaxUsa.Org. If think that you received this message in error, please
  contact your friend #wmFrom# at #wmMail# or the webmaster at www.fairtaxusa.org 
 
  </CFMAIL>
 
<title>Message sent to your friend from FairTaxUsa.Org</title>

</HEAD>



<BODY>
 
<TABLE width="468" border="0" cellspacing="0" cellpadding="0">
  <TR>
    <TD ></TD>
    <TD valign="top"> <img src="file://///CASASNUEVAS/InetPub/wwwroot/SendLink/images/logo.png" width="232" height="52"><br>
      <font color="#FFFFFF">H</font> </TD>
  </TR>
  <TR bgcolor="#000033">
    <TD>&nbsp;</TD>
    <TD valign="top"> <font color="#FFFFFF" size="5" face="Arial, Helvetica, sans-serif">Thank
      you! </font></TD>
  </TR>
  <TR bgcolor="#FFFFFF">
    <TD>&nbsp;</TD>
    <TD valign="top">&nbsp;</TD>
  </TR>
  <TR bgcolor="#FFFFFF">
    <TD>&nbsp;</TD>
    <TD valign="top" bgcolor="#FFFFFF"><font color="#990000" face="Arial, Helvetica, sans-serif"><strong>Your email
      has been sent. </strong></font>
      <hr></TD>
  </TR>
  <TR>
    <TD>&nbsp;</TD>
    <TD> <TABLE width="100%" border="0" cellspacing="0" cellpadding="1">
        <TR>
          <TD><CFOUTPUT>
              <TABLE width="422" border="0" cellpadding="1" cellspacing="0">
                <TR>
                  <TD width="66"><font size="2" face="Arial, Helvetica, sans-serif">To:</font></TD>
                  <TD width="88"> <font size="2" face="Arial, Helvetica, sans-serif">#wmTo#
                    </font></TD>
                  <TD width="77">&nbsp;</TD>
                </tr>
                <TR>
                  <TD><font size="2" face="Arial, Helvetica, sans-serif">From::</font></TD>
                  <TD> <font size="2" face="Arial, Helvetica, sans-serif">#wmFrom#</font></TD>
                  <TD>&nbsp;</TD>
                </TR>
                <TR>
                  <TD colspan="3"><font size="2" face="Arial, Helvetica, sans-serif"><IMG src="images/bump.gif" width="2"
height="5"></font></TD>
                </TR>
                <TR>
                  <TD><font size="2" face="Arial, Helvetica, sans-serif">Your
                    Email:</font></TD>
                  <TD><font size="2" face="Arial, Helvetica, sans-serif">#wmMail#
                    </font></TD>
                  <TD>&nbsp;</TD>
                </TR>
                <TR>
                  <TD colspan="3"><font size="2" face="Arial, Helvetica, sans-serif"><IMG src="images/bump.gif" width="2"
height="5"></font></TD>
                </TR>
                <TR>
                  <TD valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Subject:<br>
                    </font></TD>
                  <TD nowrap><font size="2" face="Arial, Helvetica, sans-serif">#wmSubject#
                    </font></TD>
                  <TD>&nbsp;</TD>
                </TR>
                <TR>
                  <TD colspan="3"><font size="2" face="Arial, Helvetica, sans-serif"><IMG src="images/bump.gif" width="2"
height="5"></font></TD>
                </TR>
                <TR>
                  <TD colspan="3"><font size="2" face="Arial, Helvetica, sans-serif">Message:</font></TD>
                </TR>
                <TR>
                  <TD COLSPAN="2" VALIGN="TOP"> <font size="2" face="Arial, Helvetica, sans-serif">#wmBody#</font></TD>
                  <TD>&nbsp;</TD>
                </TR>
              </TABLE>
            </CFOUTPUT> </TD>
        </TR>
      </TABLE></TD>
  </TR>
  <TR>
    <TD width="13">&nbsp;</TD>
    <TD width="455"><font size="4"><a
href="javascript:window.close();"><br>
      Close Window</a></font></TD>
  </TR>
</TABLE>

<--sendlink.cfm-->

<html>
<head>
<title>FairTaxUsa News Example</title>
</head>

<body>
<p><a
href="javascript:void(open('http://192.168.1.15/SendLink/emaillink.cfm?&lurl=
'+escape(location.href)+'&amp;title='+escape(document.title),'click','height
=460,width=510,title=yes,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no'))">Send A Link</a></p>
<p>INSTRUCTION TO INSTALL SEND A LINK.</p>
<p>&nbsp;</p>
</body>
</html>
Please let me know if I need to add more points.  But I really have to take care of this.  I've even tried just copying and pasting from the beggining of this posting and event that is not working.. Please Help

Charlie Perez
Sorry to respond at this hr - but i guess we r in diff time zones !

change ur code for mailit.cfm to :

<--mailit.cfm-->
<HEAD>
<CFPARAM name="wmFrom" DEFAULT="">
<CFPARAM name="wmSubject" DEFAULT=" ">
<CFPARAM name="wmBody" DEFAULT=" ">
<CFPARAM name="wmMail" DEFAULT=" ">
<CFPARAM name="wmURL" DEFAULT=" ">
<CFPARAM name="title" DEFAULT="anandkp"><!--- give a name here u want to appear in subject line --->
<CFMAIL FROM="charlie@fairtaxusa.org" TO="#wmTo#" BCC="charlie@heloc.net" SUBJECT="A suggested website #title# from #wmFrom#">
      Your friend #wmFrom#, (#wmMail#) wanted you to know about this website:
      
      #wmURL#
      
      Here's what #wmFrom# had to say about it:
      ===========================================================
      #wmBody#
      ===========================================================
      
      Be sure to visit soon! This message was generated by the URL referral service
      at FairTaxUsa.Org. If think that you received this message in error, please
      contact your friend #wmFrom# at #wmMail# or the webmaster at www.fairtaxusa.org
</CFMAIL>
<TITLE>Message sent to your friend from FairTaxUsa.Org</TITLE>
</HEAD>
<BODY>
<TABLE width="468" border="0" cellspacing="0" cellpadding="0">
      <TR>
            <TD ></TD>
            <TD valign="top"><IMG src="file://///CASASNUEVAS/InetPub/wwwroot/SendLink/images/logo.png" width="232" height="52"><BR><FONT color="#FFFFFF">H</FONT></TD>
      </TR>
      <TR bgcolor="#000033">
            <TD>&nbsp;</TD>
            <TD valign="top"><FONT color="#FFFFFF" size="5" face="Arial, Helvetica, sans-serif">Thank
     you!</FONT></TD>
      </TR>
      <TR bgcolor="#FFFFFF">
            <TD>&nbsp;</TD>
            <TD valign="top">&nbsp;</TD>
      </TR>
      <TR bgcolor="#FFFFFF">
            <TD>&nbsp;</TD>
            <TD valign="top" bgcolor="#FFFFFF"><FONT color="#990000" face="Arial, Helvetica, sans-serif"><STRONG>Your email
     has been sent.</STRONG></FONT>
<HR></TD>
      </TR>
      <TR>
            <TD>&nbsp;</TD>
            <TD>
            <TABLE width="100%" border="0" cellspacing="0" cellpadding="1">
                  <TR>
                        <TD>
                        <CFOUTPUT>
                              <TABLE width="422" border="0" cellpadding="1" cellspacing="0">
                                    <TR>
                                          <TD width="66"><FONT size="2" face="Arial, Helvetica, sans-serif">To:</FONT></TD>
                                          <TD width="88"><FONT size="2" face="Arial, Helvetica, sans-serif">#wmTo#</FONT></TD>
                                          <TD width="77">&nbsp;</TD>
                                    </TR>
                                    <TR>
                                          <TD><FONT size="2" face="Arial, Helvetica, sans-serif">From::</FONT></TD>
                                          <TD><FONT size="2" face="Arial, Helvetica, sans-serif">#wmFrom#</FONT></TD>
                                          <TD>&nbsp;</TD>
                                    </TR>
                                    <TR>
                                          <TD colspan="3"><FONT size="2" face="Arial, Helvetica, sans-serif"><IMG src="images/bump.gif" width="2" height="5"></FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD><FONT size="2" face="Arial, Helvetica, sans-serif">Your
                   Email:</FONT></TD>
                                          <TD><FONT size="2" face="Arial, Helvetica, sans-serif">#wmMail#</FONT></TD>
                                          <TD>&nbsp;</TD>
                                    </TR>
                                    <TR>
                                          <TD colspan="3"><FONT size="2" face="Arial, Helvetica, sans-serif"><IMG src="images/bump.gif" width="2" height="5"></FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD valign="top"><FONT size="2" face="Arial, Helvetica, sans-serif">Subject:<BR></FONT></TD>
                                          <TD nowrap><FONT size="2" face="Arial, Helvetica, sans-serif">#wmSubject#</FONT></TD>
                                          <TD>&nbsp;</TD>
                                    </TR>
                                    <TR>
                                          <TD colspan="3"><FONT size="2" face="Arial, Helvetica, sans-serif"><IMG src="images/bump.gif" width="2" height="5"></FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD colspan="3"><FONT size="2" face="Arial, Helvetica, sans-serif">Message:</FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD COLSPAN="2" VALIGN="TOP"><FONT size="2" face="Arial, Helvetica, sans-serif">#wmBody#</FONT></TD>
                                          <TD>&nbsp;</TD>
                                    </TR>
                              </TABLE>
                        </CFOUTPUT>
</TD>
                  </TR>
            </TABLE></TD>
      </TR>
      <TR>
            <TD width="13">&nbsp;</TD>
            <TD width="455"><FONT size="4"><A href="javascript:window.close();"><BR>Close Window</A></FONT></TD>
      </TR>
</TABLE>

let me know...

K'Rgds
Anand
ASKER CERTIFIED SOLUTION
Avatar of anandkp
anandkp
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank You.  I couldn't get back to you. Had a personal situation.  OK.  I got it to work.  Don't know if you can help me with this but it is not validating.  Can you help me with that?
Excellent help....Thank You.
what is not validating ???
let me know

K'Rgds
Anand
This part of the script isn't working...

<SCRIPT language="JavaScript">
function isValidEmail(email) {
   if (email=="") {
        return false;
   }
   if (email.indexOf('@')<1) {
        return false;
   }
   if (email.indexOf('.')==-1) {
        return false;
   }
   if (email.indexOf('.')==(email.length -1)) {
        return false;
   }
   if (email.indexOf('.')==(email.indexOf('@')+1)) {
        return false;
   }
   return true;
}

var errorVals = new Array();
errorVals[0] ="You must enter a valid email address in the Your Email
Address field";
errorVals[1] ="You must enter a valid email address in the To field";

function wmverify() {
   if (!isValidEmail(document.wmForm.wmMail.value)) {
        alert(errorVals[0]);
        return false;
   }
   if (document.wmForm.wmTo.value == "") {
        alert(errorVals[1]);
        return false;
   }
   return true;
}
</SCRIPT>
what is the error that ur getting

ive made a small change to ur code - not sure if thats what it is ...

<SCRIPT language="JavaScript">
function isValidEmail(email) {
  if (email=="") {
       return false;
  }
  if (email.indexOf('@')<1) {
       return false;
  }
  if (email.indexOf('.')==-1) {
       return false;
  }
  if (email.indexOf('.')==(email.length -1)) {
       return false;
  }
  if (email.indexOf('.')==(email.indexOf('@')+1)) {
       return false;
  }
  return true;
}

var errorVals = new Array();
errorVals[0] ="You must enter a valid email address in the Your Email
Address field";
errorVals[1] ="You must enter a valid email address in the To field";

function wmverify() {
  if (!isValidEmail(document.wmForm.wmMail.value)) {
       alert(errorVals[0]);
       return false;
  }
  if (!isValidEmail(document.wmForm.wmTo.value)) {
       alert(errorVals[1]);
       return false;
  }
  return true;
}
</SCRIPT>

let me know

K'Rgds
Anand
Thank You...The form is processing without validating at all.  Sorry, no error messages it simply goes on without vailidating.

I tried the new code, but it dooesn't seem to work.  Could it be perhaps because of running a JavaScript and CF together...?

Thank you....

Charlie
I was editing the tables on the emailink.cfm form--have not touched the CF or Java coding and this is what comes up.... ANy ideas why....?

Error Occurred While Processing Request  
Attribute validation error for tag CFMAIL.  
The value of the attribute TO is invalid. The length of the string, 0 character(s), must be greater than or equal to 1 character(s).  
 
The error occurred in C:\InetPub\wwwroot\SendALink\mailit.cfm: line 8
 
6 : <CFPARAM name="wmURL" DEFAULT=" ">
7 :
8 : <CFMAIL FROM="NewsRoom@FairTaxUsa.Org"
9 :         TO="#wmTo#"
10 :         BCC="charlie@heloc.net"
 
 
OK.  I got the form to work again.  Pretty much I kept the original...This is the error that I get if I try sending without filling out the email feilds.....

Charlie

Attribute validation error for tag CFMAIL.  
The value of the attribute TO is invalid. The length of the string, 0 character(s), must be greater than or equal to 1 character(s).  
 
The error occurred in C:\InetPub\wwwroot\SendLinkOriginal\mailit.cfm: line 8
 
6 : <CFPARAM name="wmURL" DEFAULT=" ">
7 :
8 : <CFMAIL FROM="NewsRoom@FairTaxUSA.Org"
9 :         TO="#wmTo#"
10 :         BCC="charlie@heloc.net"

 
I'm trying to implement the SEND A LINK TO The site and it isn't working. MY site's home page is a .cfm file. when I copy and pasted the the link it isn't working.  I made sure it was looking to the right test server.  I think the problem lies where I have an entry that looks for other Java scripts in the scripts folder.

EXAMPLE: <script language="JavaScript1.2" src="../scripts/main2.js" type="text/javascript"></script>

I linked the words Send This To A friend with: javascript:void(open('http://192.168.1.15/SendLinkOriginal/emaillink.cfm?&lurl=
'+escape(location.href)+'&amp;title='+escape(document.title),'click','height
=555,width=437,title=no,location=no,scrollbars=no,menubars=no,toolbars=no,r
esizable=no'))

Could it be that it is looking for a Java Script in the Scripts folder?  If so would you what part of the script goes in the scripts folder and what do I need to call it back...?

Thank you...DO you know how I can increase the points on this question...
ok here r the Chk points for u:

1. the "to" field value is going NULL ! [Chk it]
2. javascript & CF can work together - no problem at all.
3. if validation is going off without validating - u need to chk the return parameter used when ur validating ur form.
eg: <form OnSubmit="return JavaScriptFunctionName()" >
4. the script folder path needs to be mapped properly from where this cfm file is placed. if the mapping in not correct - it may never find ur .js file & wldnt get ur validations right !
5. abt incaresing points - we can decide later on ... once u have ur things working properly

K'Rgds
Anand
Let me give you a link for you to access.  Check out the code for the java folder.  Does that mean that I would need to put the validation scripting within the folder for it to work properly....?

http://www.fairtaxusa.org/TestSite/newsroom.cfm

Note Tell-A-Friend Not active yet....

2.  As I expressed initially, This is all new to me so if you could explain in layman terms (1) and (3) I'd appreciated very much. If I send the message without imputting any information on the boxes, a CF server message comes up in the window.

Thank You...
abt point 1. in ur code
<CFPARAM name="wmURL" DEFAULT=" ">
<CFMAIL FROM="NewsRoom@FairTaxUSA.Org"
TO="#wmTo#"
BCC="charlie@heloc.net"

the value of "wmto" is NULL - this shldnt be the case when ur sending the email so ti shld have some valid email address to it

abt point 3. assuming i have the following code [pls copy paste in a new file & run it to see how it works]

<SCRIPT language="JavaScript">
function valthisform()
{
   alert('Hi I am validating ur form')
   return false;
}
</SCRIPT>

<form OnSubmit="return valthisform()">
   <input type="submit">
</form>

I hope the above helps u to understand things

K'Rgds
Anand
OK.  I copied your code to a page and when I view in browser and press the submit, I get the "Hi I am validating ur form"

By the way the link is

http://www.fairtaxusa.org/TestSite/home.htm

Thank you,
Here is the latest code that I have for the emaillink.cfm file....Thank You

<HEAD>
<TITLE>FairTaxUsa.Org - Tell-A-Friend Email Service</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="ccs/sendFriendBarTex.css" rel="stylesheet" type="text/css">
</HEAD>
<FORM name="wmForm" method="post" action="mailit.cfm">
     <TABLE width="468" border="0" cellspacing="0" cellpadding="0">
<SCRIPT language="JavaScript">
function isValidEmail(email) {
    if (email=="") {
         return false;
    }
    if (email.indexOf('@')<1) {
         return false;
    }
    if (email.indexOf('.')==-1) {
         return false;
    }
    if (email.indexOf('.')==(email.length -1)) {
         return false;
    }
    if (email.indexOf('.')==(email.indexOf('@')+1)) {
         return false;
    }
    return true;
}

var errorVals = new Array();
errorVals[0] ="You must enter a valid email address in the Your Email
Address field";
errorVals[1] ="You must enter a valid email address in the To field";

function wmverify() {
    if (!isValidEmail(document.wmForm.wmMail.value)) {
         alert(errorVals[0]);
         return false;
    }
    if (document.wmForm.wmTo.value == "") {
         alert(errorVals[1]);
         return false;
    }
    return true;
}
</SCRIPT>
          <CFOUTPUT>
               <INPUT TYPE="hidden" NAME="wmURL" value="#lurl#">
          </CFOUTPUT>
<BODY leftmargin="1" topmargin="7">
<TR>
               <TD></TD>
               
  <TD><img src="images/logo.png" width="232" height="52"><CFOUTPUT>
      <DIV align="center"><br>
        <table width="92%" border="0" align="left">
          <tr>
            <td bgcolor="##000066"> <div align="left" class="SendFriendBarText"><font size="5" face="Arial, Helvetica, sans-serif">
                &nbsp;&quot;<font size="4"><strong>Tell-A-Friend About This Article...!</strong></font></font><strong><font size="4" face="Arial, Helvetica, sans-serif">!&quot;</font></strong><font size="1" face="Arial, Helvetica, sans-serif"><br>
                </font></div></td>
          </tr>
          <tr>
            <td height="14"><div align="center"><font size="1" face="Arial, Helvetica, sans-serif">Fill
                out the form below and we'll send a personalized email from you
                to a friend or colleague about:</font><font size="1" face="Arial, Helvetica, sans-serif">
                </font></div></td>
          </tr>
          <tr>
            <td height="14"><div align="center"><font color="cc0000">#title#</font>. </div></td>
          </tr>
        </table>
        <div align="center"><BR>
          <FONT color="cc0000"><br>
          </FONT><font size="1" face="Arial, Helvetica, sans-serif"><br>
          </font><FONT color="cc0000"><br>
          </FONT></div>
      </DIV>
    </CFOUTPUT> </TD>
</TR>
<TR>
  <TD >&nbsp;</TD>
          </TR>
          <TR>
               <TD>&nbsp;</TD>
               <TD>
               <TABLE border="0" cellspacing="0" cellpadding="1" width="58%">
                    <TR>
                         <TD height="292" colspan="2">
                         <TABLE width="408" border="0" cellpadding="3" cellspacing="0">
            <TR>
              <TD width="143" valign="middle"><FONT size="2" face="Arial, Helvetica, sans-serif">Friend's
                Email:</FONT></TD>
              <TD width="253" valign="top"> <P>
                  <INPUT TYPE="text" NAME="wmTo" SIZE="22" value="">
                  <FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">&nbsp;(required)</FONT><FONT color="#FF0000"><BR>
                  </FONT></P></TD>
            </TR>
            <TR>
              <TD valign="bottom"><FONT size="2" face="Arial, Helvetica, sans-serif">Your
                Name:</FONT></TD>
              <TD> <INPUT TYPE="text" NAME="wmFrom" SIZE="22" value=""></TD>
            </TR>
            <TR>
              <TD valign="bottom"><FONT size="2" face="Arial, Helvetica, sans-serif">Your
                Email:</FONT><BR></TD>
              <TD valign="top"> <INPUT TYPE="text" NAME="wmMail" SIZE="22" value="">
                <FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">&nbsp;(required)</FONT></TD>
            </TR>
            <TR>
              <TD><font size="2" face="Arial, Helvetica, sans-serif">Newsletter:</font></TD>
              <TD><input name="checkbox" type="checkbox" value="checkbox" checked>
                <font size="2" face="Arial, Helvetica, sans-serif">Send me FairTax
                complimentary updates!</font></TD>
            </TR>
            <TR>
              <TD valign="top"><FONT size="2" face="Arial, Helvetica, sans-serif">Subject:</FONT></TD>
              <TD> <CFOUTPUT>
                  <INPUT TYPE="text" NAME="wmSubject" SIZE="42" value="#title#">
                  <br>
                  <INPUT TYPE="hidden" NAME="send" SIZE="42">
                  <input type="hidden" name="clickMap" size="42">
                </CFOUTPUT> </TD>
            </TR>
            <TR>
              <TD colspan="2"><FONT size="2" face="Arial, Helvetica, sans-serif"><STRONG>Message:</STRONG></FONT></TD>
            </TR>
            <TR>
              <TD COLSPAN="2" VALIGN="TOP"> <div align="right">
                  <TEXTAREA NAME="wmBody" rows="6" cols="50"></TEXTAREA>
                  <br>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="59%"><div align="justify"><FONT color="#666666" size="1" face="Arial, Helvetica, sans-serif"><br>
                          Your email address is only used so that your friend
                          can conveniently reply. We <B><U>never</U></B> add email
                          addresses to our mailing lists without your permission.</FONT></div></td>
                      <td width="41%"><div align="right"><a href="javascript:document.wmForm.clickMap.value='sendEmail';document.wmForm.
send.value=1;document.wmForm.submit();"><img src="images/sendToFriend.png" width="100" height="26" border="0"></a></div></td>
                    </tr>
                  </table>
                </div></TD>
            </TR>
          </TABLE></TD>
                    </TR>
               </TABLE></TD>
          </TR>
          <TR>
               <TD>&nbsp;</TD>
               
  <TD></FORM> </TD>
</TR>
</BODY>
I dont see a "go" button there ???

what do i do after entering my name & email address ??

K'Rgds
Anand
Replace ur code with this

this has to WORK for sure !!!


<HEAD>
<TITLE>FairTaxUsa.Org - Tell-A-Friend Email Service</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><LINK href="ccs/sendFriendBarTex.css" rel="stylesheet" type="text/css">
</HEAD>
<SCRIPT language="JavaScript">
function isValidEmail(email) {
   if (email=="") {
        return false;
   }
   if (email.indexOf('@')<1) {
        return false;
   }
   if (email.indexOf('.')==-1) {
        return false;
   }
   if (email.indexOf('.')==(email.length -1)) {
        return false;
   }
   if (email.indexOf('.')==(email.indexOf('@')+1)) {
        return false;
   }
}

var errorVals = new Array();
errorVals[0] ="You must enter a valid email address in the Your Email Address field";
errorVals[1] ="You must enter a valid email address in the To field";

function wmverify() {
   document.wmForm.clickMap.value='sendEmail';
   document.wmForm.send.value=1
   
   if (!isValidEmail(document.wmForm.wmMail.value)) {
        alert(errorVals[0]);
        return false;
   }
   if (!isValidEmail(document.wmForm.wmTo.value)) {
        alert(errorVals[1]);
        return false;
   }
}
</SCRIPT>

<FORM name="wmForm" method="post" action="mailit.cfm" ONSUBMIT="return wmverify()">
      <TABLE width="468" border="0" cellspacing="0" cellpadding="0">

            <CFOUTPUT>
                  <INPUT TYPE="hidden" NAME="wmURL" value="#lurl#">
            </CFOUTPUT>
<BODY leftmargin="1" topmargin="7">
            <TR>
                  <TD></TD>
                  <TD><IMG src="images/logo.png" width="232" height="52">
                  <CFOUTPUT>
                        <DIV align="center"><BR>
                              <TABLE width="92%" border="0" align="left">
                                    <TR>
                                          <TD bgcolor="##000066">
                                          <DIV align="left" class="SendFriendBarText"><FONT size="5" face="Arial, Helvetica, sans-serif">&nbsp;&quot;<FONT size="4"><STRONG>Tell-A-Friend About This Article...!</STRONG></FONT></FONT><STRONG><FONT size="4" face="Arial, Helvetica, sans-serif">!&quot;</FONT></STRONG><FONT size="1" face="Arial, Helvetica, sans-serif"><BR></FONT>
                                          </DIV></TD>
                                    </TR>
                                    <TR>
                                          <TD height="14">
                                          <DIV align="center"><FONT size="1" face="Arial, Helvetica, sans-serif">Fill
               out the form below and we'll send a personalized email from you
               to a friend or colleague about:</FONT><FONT size="1" face="Arial, Helvetica, sans-serif"></FONT>
                                          </DIV></TD>
                                    </TR>
                                    <TR>
                                          <TD height="14">
                                          <DIV align="center"><FONT color="cc0000">#title#</FONT>.
                                          </DIV></TD>
                                    </TR>
                              </TABLE>
                              <DIV align="center"><BR><FONT color="cc0000"><BR></FONT><FONT size="1" face="Arial, Helvetica, sans-serif"><BR></FONT><FONT color="cc0000"><BR></FONT>
                              </DIV>
                        </DIV>
                  </CFOUTPUT>
</TD>
            </TR>
            <TR>
                  <TD >&nbsp;</TD>
            </TR>
            <TR>
                  <TD>&nbsp;</TD>
                  <TD>
                  <TABLE border="0" cellspacing="0" cellpadding="1" width="58%">
                        <TR>
                              <TD height="292" colspan="2">
                              <TABLE width="408" border="0" cellpadding="3" cellspacing="0">
                                    <TR>
                                          <TD width="143" valign="middle"><FONT size="2" face="Arial, Helvetica, sans-serif">Friend's
               Email:</FONT></TD>
                                          <TD width="253" valign="top">
<P>
                                          <INPUT TYPE="text" NAME="wmTo" SIZE="22" value=""><FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">&nbsp;(required)</FONT><FONT color="#FF0000"><BR></FONT></P></TD>
                                    </TR>
                                    <TR>
                                          <TD valign="bottom"><FONT size="2" face="Arial, Helvetica, sans-serif">Your
               Name:</FONT></TD>
                                          <TD>
                                          <INPUT TYPE="text" NAME="wmFrom" SIZE="22" value=""></TD>
                                    </TR>
                                    <TR>
                                          <TD valign="bottom"><FONT size="2" face="Arial, Helvetica, sans-serif">Your
               Email:</FONT><BR></TD>
                                          <TD valign="top">
                                          <INPUT TYPE="text" NAME="wmMail" SIZE="22" value=""><FONT color="#FF0000" size="1" face="Arial, Helvetica, sans-serif">&nbsp;(required)</FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD><FONT size="2" face="Arial, Helvetica, sans-serif">Newsletter:</FONT></TD>
                                          <TD>
                                          <INPUT name="checkbox" type="checkbox" value="checkbox" checked><FONT size="2" face="Arial, Helvetica, sans-serif">Send me FairTax
               complimentary updates!</FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD valign="top"><FONT size="2" face="Arial, Helvetica, sans-serif">Subject:</FONT></TD>
                                          <TD>
                                          <CFOUTPUT>
                                                <INPUT TYPE="text" NAME="wmSubject" SIZE="42" value="#title#"><BR>
                                                <INPUT TYPE="hidden" NAME="send" SIZE="42">
                                                <INPUT type="hidden" name="clickMap" size="42">
                                          </CFOUTPUT>
</TD>
                                    </TR>
                                    <TR>
                                          <TD colspan="2"><FONT size="2" face="Arial, Helvetica, sans-serif"><STRONG>Message:</STRONG></FONT></TD>
                                    </TR>
                                    <TR>
                                          <TD COLSPAN="2" VALIGN="TOP">
                                          <DIV align="right">
                                                <TEXTAREA NAME="wmBody" rows="6" cols="50"></TEXTAREA><BR>
                                                <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
                                                      <TR>
                                                            <TD width="59%">
                                                            <DIV align="justify"><FONT color="#666666" size="1" face="Arial, Helvetica, sans-serif"><BR>Your email address is only used so that your friend
                         can conveniently reply. We<B><U>never</U></B>add email
                         addresses to our mailing lists without your permission.</FONT>
                                                            </DIV></TD>
                                                            <TD width="41%">
                                                            <DIV align="right"><Input type="image" src="images/sendToFriend.png" width="100" height="26" border="0">
                                                            </DIV></TD>
                                                      </TR>
                                                </TABLE>
                                          </DIV></TD>
                                    </TR>
                              </TABLE></TD>
                        </TR>
                  </TABLE></TD>
            </TR>
            <TR>
                  <TD>&nbsp;</TD>
                  <TD>
</FORM></TD>
</TR>
</BODY>


K'Rgds
Anand


The good news is that it alerts.  However, it continues to alert even with the fields properly filled out. It won't process...

Thank You.
ok atleast we r into next phase now.

so i hope uve learned the logic abt validating the forms ... good :)

ok now abt it not validating properly !

replace ur javascript code with this that i use for my sites

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function wmverify()
{
    var sCont = document.wmForm.wmMail;
    var sContVal = document.wmForm.wmMail.value;
                   
    var str=new String();
    str=sContVal;
    var span=new RegExp("[ ]","g");
    var rep=str.replace(span,"9");          
                   
    if (sContVal.length != 0)
    {
        if(sContVal == ''  || isNaN(rep) == false)
        {
            alert("You must enter a valid email address in the Your Email Address field");
            sCont.focus();
            sCont.select();
            return false;
        }                        
                                               
        var sAtSym    = sContVal.indexOf('@')
        var sAtSym2       = sContVal.lastIndexOf('@')
        var sPeriod   = sContVal.lastIndexOf('.')
        var sSpace    = sContVal.indexOf(' ')
        var sLength   = sContVal.length - 1  
                             
        if ( (sAtSym < 2) || (sAtSym != sAtSym2) || (sPeriod <= sAtSym+2) || (sPeriod == sLength ) || (sSpace  != -1) )                  
        {
            alert("You must enter a valid email address in the Your Email Address field");
            sCont.focus();
            sCont.select();
            return false;
        }                          
                             
        if ((sContVal.indexOf('<')!= -1)||(sContVal.indexOf('>')!= -1)||(sContVal.indexOf('/')!= -1))
        {
        alert("You must enter a valid email address in the Your Email Address field");
        sCont.focus();
        sCont.select();
        return false;
        }
    }
   
    var sCont = document.wmForm.wmTo;
    var sContVal = document.wmForm.wmTo.value;
                   
    var str=new String();
    str=sContVal;
    var span=new RegExp("[ ]","g");
    var rep=str.replace(span,"9");          
                   
    if (sContVal.length != 0)
    {
        if(sContVal == ''  || isNaN(rep) == false)
        {
            alert("You must enter a valid email address in the To field");
            sCont.focus();
            sCont.select();
            return false;
        }                        
                                               
        var sAtSym    = sContVal.indexOf('@')
        var sAtSym2       = sContVal.lastIndexOf('@')
        var sPeriod   = sContVal.lastIndexOf('.')
        var sSpace    = sContVal.indexOf(' ')
        var sLength   = sContVal.length - 1  
                             
        if ( (sAtSym < 2) || (sAtSym != sAtSym2) || (sPeriod <= sAtSym+2) || (sPeriod == sLength ) || (sSpace  != -1) )                  
        {
            alert("You must enter a valid email address in the To field");
            sCont.focus();
            sCont.select();
            return false;
        }                          
                             
        if ((sContVal.indexOf('<')!= -1)||(sContVal.indexOf('>')!= -1)||(sContVal.indexOf('/')!= -1))
        {
        alert("You must enter a valid email address in the To field");
        sCont.focus();
        sCont.select();
        return false;
        }
    }
}
//-->
</SCRIPT>

I am dead sure this has to WORK !

K'Rgds
Anand
hello ???

ne-luck with this yet ???

K'Rgds
Anand
hello ??????????
Sorry, I took a couple days for the family.  I'll work on this today and tomorrown and will let you know...Thanks again

Charlie
Anand,

We're almost there....This is what's happening. If a user attempt to make a wrong entry, it prompts invalid email or name. However, if either or both of the entries are left blank I get the following CF server message....Is there a way of adding an "if blank" coding into the js....?

Thanks.

PS sorry it took me a few days....!

CHarlie


Error Occurred While Processing Request  
Attribute validation error for tag CFMAIL.  
The value of the attribute TO is invalid. The length of the string, 0 character(s), must be greater than or equal to 1 character(s).  
 
The error occurred in C:\InetPub\wwwroot\FairTaxUsa\SENDLINK\mailit.cfm: line 9
 
7 :
8 : <link href="ccs/emailText.css" rel="stylesheet" type="text/css">
9 : <CFMAIL FROM="NewsRoom@FairTaxUSA.Org"
10 :         TO="#wmTo#"
11 :         BCC="charlie@heloc.net"

 

--------------------------------------------------------------------------------
 
Please try the following:
Check the CFML Reference Manual to verify that you are using the correct syntax.
Search the Knowledge Base to find a solution to your problem.

 
Browser   Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0; TUCOWS)
Remote Address   192.168.1.1
Referrer   http://www.fairtaxusa.org/SendLink/emaillink.cfm?&lurl=http%3A//www.fairtaxusa.org/MAIN/index.cfm&title=Welcome%20To%20FairTaxUsa.Org 
Date/Time   14-Apr-03 03:12 AM
 
Stack Trace (click to expand)  
 
first of all - u have been adding questions on top of questions !

Ive answered u all the previous one's [i hope i'll get some good credit for that !]

for this error - use this logic !

<cfif len(trim(wmto))>
<CFMAIL FROM="NewsRoom@FairTaxUSA.Org"
        TO="#wmTo#"
         BCC="charlie@heloc.net"
.
.
.
</cfmail>
</cfif>

K'Rgds
Anand
You deserve a lot of credit.  I posted a continuation to this question at:

https://www.experts-exchange.com/questions/20584385/NEED-HELP-FINISHISNG-A-SEND-A-LINK-TO-A-FRIEND-SCRIPT-TO-VALIDATE.html

It wasn't my intention to get you upset by any means.  You have been very helpful..

Can you please help me finish the validation?  Thank You.
Did this CFIF condition help u ???

i'll look at the link & post the answere there -

hope its ok !

K'Rgds
Anand