| | |
ASP Form error
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2004
Posts: 3
Reputation:
Solved Threads: 0
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
This is the main form asp file:
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
html Syntax (Toggle Plain Text)
<% 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> </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> </p></td> </tr> </table> <!-- #EndEditable --> </body> <!-- #EndTemplate --></html>
This is the main form asp file:
html Syntax (Toggle Plain Text)
<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"> </td> </tr> <tr> <td class="heading" height="12" valign="top">IT Service Desk </td> </tr> <tr> <td class="RegularText" height="12" valign="top"> </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> <span lang="en-gb">IT</span> Department </p> </td> </tr> <tr> <td class="regulartext"> </td> </tr> <tr> <td class="regulartext"> </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> </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 & 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%"> </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"> </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> </td> </tr> </table> <!-- #EndEditable --> </body> <!-- #EndTemplate --></html>
Last edited by peter_budo; Feb 10th, 2008 at 6:34 am. Reason: Please use [code] tags
•
•
Join Date: Feb 2008
Posts: 62
Reputation:
Solved Threads: 4
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...
Make sense? If not just let us know.
ASP Syntax (Toggle Plain Text)
Dim strBody strBody = "Required Equipment: " & Request.Form("requirement") cdoMessage.TextBody = strBody
Make sense? If not just let us know.
•
•
Join Date: Aug 2004
Posts: 3
Reputation:
Solved Threads: 0
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
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
Last edited by Nyall; Feb 8th, 2008 at 5:03 am.
•
•
Join Date: Feb 2008
Posts: 62
Reputation:
Solved Threads: 4
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:
Hope this cleared it up for you.
ASP Syntax (Toggle Plain Text)
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.
![]() |
Similar Threads
- Potentially Dangerous Request.Form? Error (ASP.NET)
- Updated : Simple ASP.Net Login Page (ASP.NET)
- Equivalent ASP Snippet for PHP Spam Trap (ASP)
- asp form action script (Site Layout and Usability)
- Syntax error (missing operator) in query expression 'OrderNo='.HELP PLEASE (ASP)
- Asp,ms Access,iis (ASP)
- Error while trying the update query (ASP)
- radio button ASP question?? (ASP)
- asp form problem (ASP)
Other Threads in the ASP Forum
- Previous Thread: user login module
- Next Thread: Help: passing variable via table field different page subroutine
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7





