hi guys,.. am trying to get this asp form to send the information it has to me, however.. i keep running in to brick walls, as it returns fine, just with no information. so you can imagine its not ideal.

anyway, ill supply the code here, i know its to do with the av_sent.asp file, i just cant figure out where as the cdoMessage.Textbody line confuses me. i have all these feilds that need information to be attached to them and im coming up short.

cheers in advance.

nyall

this is the av_sent.asp

<%
theSchema="http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig=server.CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(theSchema & "sendusing")=2
cdoConfig.Fields.Item(theSchema & "smtpserver")="pegasus"
cdoConfig.Fields.Update

set CdoMessage=Server.CreateObject("CDO.Message")
cdoMessage.Configuration=cdoConfig

cdoMessage.From=request.form("emailAddress")
cdoMessage.To="itservices@someplace.org.uk"
cdoMessage.Subject=request.form("name")
cdoMessage.TextBody=request.form("body")

cdoMessage.Send

Set cdoMessage=Nothing
Set cdoConfig=Nothing

%>

<html><!-- #BeginTemplate "/Templates/rightframe.dwt" --><!-- DW6 -->
<head>
<!-- #BeginEditable "doctitle" -->
<title>IT</title>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../../../IntranetStyle.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<!-- #BeginEditable "body" -->
<table width="80%" border="0" cellspacing="0" cellpadding="0" class="regulartext">
  <tr>
    <td><img src="images/it.gif" width="43" height="29"><a name="Top"></a></td>
  </tr>
  <tr>
    <td width="97%" class="RegularText" height="12" valign="top"><p>&nbsp;</p>
    <p>Thank<span lang="en-gb"> </span>you<span lang="en-gb">,</span> your message has now been sent to the
	<span lang="en-gb">IT</span> helpdesk, w<span lang="en-gb">ho</span> will be in touch shortly.</p>
    <p>IT Department </p>
    <p>&nbsp;</p></td>
  </tr>
</table>
<!-- #EndEditable -->
</body>
<!-- #EndTemplate --></html>

This is the main form asp file:

<html><!-- #BeginTemplate "/Templates/rightframe.dwt" --><!-- DW6 -->
<head>
<!-- #BeginEditable "doctitle" -->
<title>AV Support</title>
<style type="text/css">
<!--
.style3 {font-size: 9pt}
.style4 {
	white-space: normal;
}
.style5 {
	margin-bottom: 0px;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->
</script>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../IntranetStyle.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<!-- #BeginEditable "body" -->
<table width="60%" border="0" cellspacing="0" cellpadding="0" class="regulartext">
  <tr>
    <td><img src="images/it.gif" width="43" height="29"><a name="Top"></a></td>
  </tr>
  <tr>
    <td width="97%" class="RegularText" height="12" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td class="heading" height="12" valign="top">IT Service Desk </td>
  </tr>
  <tr>
    <td class="RegularText" height="12" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td class="RegularText"><p style="width: 580px">Please use the form below to request AV support for a presentation. This form must be submitted <strong>at least three working days</strong> 
	before the presentation dat<span lang="en-gb">e.</span></p>
    <p>&nbsp;<span lang="en-gb">IT</span> Department </p>
	</td>
  </tr>
  <tr>
    <td class="regulartext">&nbsp;</td>
  </tr>
  <tr>
    <td class="regulartext">&nbsp;</td>
  </tr>
  <tr>
    <td class="regulartext"><form action="av_sent.asp" method="POST" name="frm_message" id="frm_message">
      <table width="583" border="0" cellpadding="3" bgcolor="#CCCCFF" class="style5">
        <tr valign="middle">
          <td class="SubHeading" style="width: 38%">
			<span lang="en-gb" class="heading">Email</span></td>
          <td width="66%"><label>
            <input name="emailAddress" type="text" class="RegularText" id="emailAddress" size="55">
          </label></td>
        </tr>
        <tr align="left" valign="middle">
          <td class="heading" style="width: 38%; height: 34px;">
			<span lang="en-gb" class="heading">Name</span></td>
          <td style="height: 34px"><label>        
            <input name="name" type="text" class="RegularText" id="name" size="55">
          </label></td>
        </tr>
        <tr valign="middle">
          <td class="SubHeading" style="width: 38%"><span lang="en-gb">Type/ 
			Title of Presentation<br>
                                              <span class="heading">(eg. General 
			Studies, Tutorial)</span></span><span class="style3"> </span></td>
          <td><label>
            <input name="subject" type="text" class="RegularText" id="subject" size="55">
          </label></td>
        </tr>
        <tr>
          <td style="width: 38%"><span lang="en-gb">Date of Presentation</span></td>
          <td><a href="javascript:;" onClick="window.open('popup.aspx?textbox=date','cal','width=250,height=225')">
			Please click here to select a date</a>
                                              <input name="date" type="text" id="date" size="15" runat="server" style="width: 137px">                                            </td>
        </tr>
        <tr>
          <td style="width: 38%"><span lang="en-gb">Time of Presentation<br>
                                              <span class="heading">(eg. Period 4, 
			Assembly)</span></span></td>
          <td><label>
            <input name="Time" type="text" class="RegularText" id="Time" size="55"></label></td>
        </tr>
        <tr>
          <td style="width: 38%"><span lang="en-gb">Location of presentation <br>
                                                <span class="heading">(eg. Big 
			School, DHA)</span></span></td>
          <td class="style4"><label>
            <input name="Location" type="text" class="RegularText" id="Location" size="55"></label></td>
        </tr>
        <tr>
          <td style="width: 38%; height: 62px">Please provide an overview of<span lang="en-gb" class="heading"> 
			your presentation<br>
                                              <span class="heading">(eg. 'Run a 
			PowerPoint presentation')</span></span></td>
          <td style="height: 62px"><label>
            <textarea name="overveiw" class="RegularText" id="overveiw" style="width: 337px; height: 33px" rows="1" cols="20"></textarea></label>&nbsp;</td>
        </tr>
        <tr>
          <td style="width: 38%" class="heading">Will you be providing any equipment and/or 
			media?<br>
      	(eg. laptop, slide projector, OHP)<br></td>
          <td><label>
            <textarea name="equipment" class="RegularText" id="equipment" style="width: 337px; height: 33px" rows="1" cols="20"></textarea></label></td>
        </tr>
        <tr>
          <td style="width: 38%">Will you require any equipment? Please specify
			<span lang="en-gb" class="heading">here.<br>
      	(eg. laptop, projector &amp; screen, speakers, microphone, slide projector, 
			OHP)</span><br></td>
          <td><label>
            <textarea name="requirement" class="RegularText" id="requirement" style="width: 337px; height: 33px" rows="1" cols="20"></textarea></label></td>
        </tr>
        <tr>
          <td style="width: 38%" class="heading">Please leave any additional information
			<span lang="en-gb">here.</span></td>
          <td><label>
            <textarea name="moreinfo" class="RegularText" id="moreinfo" style="width: 337px; height: 33px" rows="1" cols="20"></textarea></label></td>
        </tr>
        <tr>
          <td style="width: 38%">&nbsp;</td>
          <td><label>
            <input name="Submit" type="submit" onClick="MM_validateForm('emailAddress','','RisEmail','name','','R','Title','','R','date','','R','Time','','R','Location','','R','overveiw','','R');return document.MM_returnValue" value="Submit">
          <span lang="en-gb">&nbsp; </span>
			<input name="Reset1" type="reset" value="reset" style="width: 59px"></label></td>
        </tr>
      </table>
		<p style="width: 579px">If you are supplying media to run on our equipment<span lang="en-gb">, 
	Please give your media to joe blogs, Resources Technician, <strong>at 
	least three working days</strong> prior to the presentation.</span></p>
        </form>      
	<p style="width: 577px"><span lang="en-gb">If you are supplying equipment to run your media 
	Please supply your equipment and media to Joe Blogs, Resources 
	Technician, as early as possible on the day of the event and ensure that you 
	have tested the media on your equipment in advance of the presentation. If 
	supplying a laptop, please ensure that it is Windows-compatible.</span></p>
	</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<!-- #EndEditable -->
</body>
<!-- #EndTemplate --></html>

It looks like you're assigning the TextBody property of your CDO message to Request.Form("body") and you don't have an input element on your form named body. You'll want to do something like this...

Dim strBody
strBody = "Required Equipment: " & Request.Form("requirement")
cdoMessage.TextBody = strBody

Make sense? If not just let us know.

thanks for the reply,

i kinda understand, i realised it had to do with that section of the html, i just lack the understanding of how to include all of the text fields, rather 'glue' them together so it sends all the info. ill give it a bash with what you suggested, although i have to admit i get easily confused, especially about the textbody line

cheers

nyall

p.s

this may sound stupid.. but ill never know otherwise. can i not just add the names of the txt fields to the code.. like..

cdoMessage.From=request.form("emailAddress")
cdoMessage.To="itservices@someplace.org.uk"
cdoMessage.Subject=request.form("name")
cdoMessage.Required equipment =request.form("required")
cdoMessage.TextBody=request.form("body")

eg^

cheers

It doesn't really work like that. The TextBody (or HTMLBody) is the only property that will be included as the body of the email. So you will want to assign everything that you want in the email body to one of those properties. You can use the format below to do this:

cdoMessage.TextBody = "Required Equipment: " & Request.Form("required") & vbNewLine

'use the following line as a guide when adding more fields to the email, not the previous line

cdoMessage.TextBody = cdoMessage.TextBody & "Additional Information: " & Request.Form("moreinfo") & vbNewLine

Hope this cleared it up for you.

many thanks mate, i will endevour to use what you hve written to try and get this form off the ground, tho im sure ill end up confused again heh

cheers

nyall

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.