SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Emailing application acceptance results

    Hi All,
    I will briefly explain my scenario.
    I have inherited an event registration database in ASP.
    this is how it works....
    a web user will fill out a form (html)
    this is then verified and sent to a database (access), and an autoresponse sent back (cdosys) to the registrant which is all good.
    A control panel (asp) is then accessed by an admin who will then check the details of the registrant and then manually replies with an email. Which is obviously time consuming. What i need to develop is a simple way to "capture the record on screen and with the click of a button on the page to send the registrant an acceptance email with all fields shown along with an autogenerated event entrance number (this number has already been processed in the DB as a submissionID field).

    Can anyone at least point me in the right direction on the best method to achieve this? I appreciate greatly any help offered.
    Here is the code of the viewsubmission.asp page..
    Code ASP:
    <!--#include file="incSystem.asp" -->
    <%lvl=validate(0)
    formid=0
    submissionid=request("submissionid")
    if submissionid="" or not(isnumeric(submissionid)) or submissionid="0" then response.redirect "logout.asp"
     
    set conn=server.createobject("ADODB.Connection")
    conn.open connection
     
    '/// Check if the user has access to it
    if lvl=0 and limituseraccess<>"" then condition=" and formid in (select formid from xlaAFPiUsersForms where userid=" & getusrid & ")"
    psql="select * from xlaAFPforms where formid in (select formid from xlaAFPsubmissions where submissionid=" & submissionid & condition & ")"
    set rs=conn.execute(psql)
    if not(rs.eof) then
    	formname=rs("formname")
    	formdesc=rs("formdesc")
    	formid=rs("formid")
    end if
    rs.close
    set rs=nothing
     
     
     
    '/// Get Submission Info
    psql="select * from xlaAFPsubmissions where submissionid=" & submissionid
    set rs=conn.execute(psql)
    if not(rs.eof) then
    	dateposted=rs("dateposted")
    	ip=rs("ip")
     
    	submissionform=rs("submissionform")
    	submissiondata=rs("submissiondata")
    end if
    rs.close
    set rs=nothing
    conn.close
    set conn=nothing
     
    if dateposted="" or formid=0 then response.redirect "logout.asp"
     
     
    '/// Split Fields and values
    tfields=split(submissionform,divider)
    tvalues=split(submissiondata,divider)
     
     
    function formattext(what)
    	a=what
    	a=server.htmlencode(a)
    	a=replace(a,vbcrlf,"<br>")
     
    	'/// Auto-link
    	Set loRegExp = New RegExp
    	loRegExp.Global = True
    	loRegExp.IgnoreCase = True
    	loRegExp.Pattern = "((ht|f)tps?://\S+[/]?[^\.])([\.]?.*)"
    	a = loRegExp.Replace(a, "<A href=""$1"" target=""_blank"">$1</A>$3")
    	loRegExp.Pattern = "(\S+@\S+.\.\S\S\S?)"
    	a = loRegExp.Replace(a, "<A href=""mailto:$1?subject=BMAM EXPO ASIA 2010&Body="">$1</A>")
    	Set oRegExp = Nothing
    	formattext=a
    end function
     
    '/// Can the user edit / delete the record ?
    iseditable=1
    if allowdelete="" and lvl=0 then iseditable=0
    function showfield(whatname,whatvalue)
    	'//// Select the proper field type
    	ismultiline=false
    	thelen=len(whatvalue)
    	if thelen<5 then 
    		flen="10"
    	elseif thelen<=255 then
    		flen="50"
    	else
    		ismultiline=true
    	end if
     
    	if instr(whatvalue,vbcrlf) then ismultiline=true
    	if ismultiline then
    		htmlfield="<textarea name=""" & whatname & """ cols=40 rows=6>" & whatvalue & "</textarea>"
    	else
    		htmlfield="<input name=""" & whatname & """ type=text value=""" & whatvalue & """ size=" & flen & ">"	
    	end if
    	showfield="<span id=""sp" & whatname & """>" & htmlfield & "</span> <a href=javascript:decrease('" & whatname & "');><img src=images/btnCollapse.gif align=absmiddle border=0 alt=Collapse></a> <a href=javascript:increase('" & whatname & "');><img src=images/btnExpand.gif align=absmiddle border=0 alt=Expand></a>"
    end function
    function showvcode(whatname,whatvalue)
    	'//// Select the proper field type
    			htmlfield="<input name=""" & whatname & """ type=text value=""" & whatvalue & """ size=1" & flen & ">"
    			flen="1"
    	showvcode="<span id=""sp" & whatname & """>" & htmlfield & "</span> <a href=javascript:decrease('" & whatname & "');></a> <a href=javascript:increase('" & whatname & "');></a>"
    end function
     
     
    %>
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title><%=formname%> (<%=submissionid%>)</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    function doprint(){
    	document.getElementById("menupanel").style.display='none';
    	self.print();
    	document.getElementById("menupanel").style.display='';
    }
     
    function dodelete(){
    	if (confirm('Delete this record?')) self.location.href='search.asp?kill=<%=submissionid%>&formid=<%=formid%>';
    }
    </script>
     
    <style type="text/css">
    .BLUE {
    	background-color: #00C;
    	padding: 3px;
    	font-family: Verdana, Geneva, sans-serif;
    	font-size: 18px;
    	font-style: normal;
    	color: #FFF;
    	border: thin solid #FFF;
    }
    </style>
    </head>
     
    <body>
    <table width="96%" border="0" align="center" cellpadding="2" cellspacing="1">
      <tr align="left" valign="top" id="menupanel" style="display:"> 
        <td width="33%"><font size="2" face="Arial, Helvetica, sans-serif"><b> <img src="images/icrecord.gif" width="19" height="15" align="absmiddle"> 
          View Record</b></font></td>
        <td align="right"><a href="javascript:doprint();"><img src="images/btnPrintrecord.gif" width="114" height="18" border="0"></a> 
          <%if iseditable=1 then%>
          <a href="editsubmission.asp?submissionid=<%=submissionid%>"><img src="images/btnEditrecord.gif" alt="Edit Record" width="114" height="18" border="0"></a> 
          <a href="javascript:dodelete();"><img src="images/btnDeleterecord.gif" alt="Delete This  Record" width="114" height="18" border="0"></a> 
          <%end if%>
        </td>
      </tr>
      <tr align="left" valign="top" bgcolor="#999999"> 
        <td colspan="2"></td>
      </tr>
      <tr align="left" valign="top"> 
        <td width="33%" height="215"><table width="98%" border="0" cellspacing="2" cellpadding="2">
            <tr> 
              <td bgcolor="#000099"><font size="2" face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF" size="3">Properties 
                </font></b>:</font></td>
            </tr>
            <tr> 
              <td bgcolor="#F3F3F3"><font size="2" face="Arial, Helvetica, sans-serif"><b>Form 
                Name :</b><br>
                <%=formname%></font></td>
            </tr>
            <tr> 
              <td bgcolor="#F3F3F3"><font size="2" face="Arial, Helvetica, sans-serif"><b>Form 
                Description :</b><br>
                <%=formattext(formdesc)%></font></td>
            </tr>
            <tr> 
              <td bgcolor="#F3F3F3"><font size="2" face="Arial, Helvetica, sans-serif"><b>Date 
                Submitted :</b><br>
                <%=dateposted%></font></td>
            </tr>
            <tr> 
              <td bgcolor="#F3F3F3"><font size="2" face="Arial, Helvetica, sans-serif"><b>IP 
                Address :</b><br>
                <%=ip%></font></td>
            </tr>
            <tr>
              <td height="22" align="left" valign="top" bgcolor="#F3F3F3"><font size="2" face="Arial, Helvetica, sans-serif" ><b>Visitor Code:</b></font>
    <div class="BLUE"><div align="center">
      <p><font size="6" face="Arial, Helvetica, sans-serif"color="WHITE"><%=formattext(tvalues(4))%></font><font size="6" face="Arial, Helvetica, sans-serif"color="WHITE"><%=formattext(tvalues(15))%></font><font size="6" face="Arial, Helvetica, sans-serif"color="WHITE"><%Function PadDigits(n, totalDigits)PadDigits = Right(String(totalDigits,"0") & n, totalDigits)End Function 
    Response.Write(PadDigits(submissionid,5))%>
      </font></p>
    </div>
    </div></td>
            </tr>
          </table></td>
        <td><table width="100%" border="0" cellspacing="2" cellpadding="2">
            <tr> 
              <td colspan="2" bgcolor="#000099"><b><font color="#FFFFFF" size="3" face="Arial, Helvetica, sans-serif">Form 
                Results</font></b></td>
            </tr>
            <%for x=0 to ubound(tfields)-1%>
            <tr align="left" valign="top"> 
              <td width="33%" bgcolor="#CCCCCC"><b><font  size="2" face="Arial, Helvetica, sans-serif"><%=formatfieldname(tfields(x))%> : </font></b></td>
              <td bgcolor="#F3F3F3"><font size="2" face="Arial, Helvetica, sans-serif"><%=formattext(tvalues(x))%>&nbsp;</font></td>
            </tr>
            <%next%>
            <tr> 
              <td colspan="2" bgcolor="#666666"></td>
            </tr>
          </table></td>
      </tr>
    </table>
     
    </body>
    </html>

    Thanks again....
    Bill
    Last edited by Mittineague; Aug 28, 2010 at 18:08. Reason: Add code

  2. #2
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone??..

  3. #3
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Probably the easiest way is to add a button for the admin to click. This then sends the submissionid to another field that gets the relevant data from the database based on this id, prepares the email and then uses CDOSYS to send the email. (This page could also update the database to record that the email has been sent). After sending the email you can then decide where to send the admin - to the next record to be reviewed?
    Ian Anderson
    www.siteguru.co.uk

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,037
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Yeah this sounds pretty easy to me...

    A control panel (asp) is then accessed by an admin who will then check the details of the registrant and then manually replies with an email.
    I expect during this review there is a button to accept or reject the applicant?

    If there is, as siteguru suggested, add a few lines of code to the block of code that is activated during the acceptance procedure so that a form letter is sent using CDOSYS. If there isn't, you can still add a button to send the message.

    You could have a button for accept or reject and add code to send a message for either scenario.

    There are plenty of articles available discussing how to send an email using ASP including this one (quite dated) which talks about the differences between CDONTS and CDOSYS. Figure out what system is available (cdonts/cdosys) and then if you need some examples to work from search "vbscript cdosys" or "vbscript cdonts"
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •