473,382 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

HTML form generating semi- blank emails

Hi, My HTML form is generating some blank email
responses; does anyone see anything wrong with the scripts?:

function isFormVarExcluded(thisForm, strToCheck)
{
var strExcludeVars = thisForm.elements["$excludevars"].value;
var arrExcludeVars = strExcludeVars.split(",");
for (var j=0; j<arrExcludeVars.length; j++)
{
if (arrExcludeVars[j] == strToCheck) return true;
}
return false;
}
function getFormVars(thisForm)
{
var oFormVars = thisForm.elements["$formvars"];
var strPrevVal = "";
oFormVars.value = "";
for (var x=0,objElem=null; objElem=thisForm.elements.item(x);x
++)
{
if (!isFormVarExcluded(thisForm, objElem.name))
{
if (objElem.name != strPrevVal)
oFormVars.value += objElem.name +
",";
}
strPrevVal = objElem.name;
}
oFormVars.value =
oFormVars.value.substr(0,oFormVars.value.length-1);

This is on the server. I didn't create it but it looks like a
validator script. The emails I receive (form responses) sometimes
have
only []: in the body but some come in filled out properly (contact
info, product interest, etc.). There's also a validator in the HTML
form page:
<script language="javascript" type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var
i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2];
val=document.getElementById(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>
Then there's this in the form tag:
<form action="../../scripts/handleInfoRequest.asp" method="post"
name="info_request"
onSubmit="getFormVars(document.info_request);MM_va lidateForm('name','','R',¬'phone','','R','email',' ','RisEmail','state','','R');return
document.MM_returnValue">
which refers to this on the server:
<%@LANGUAGE = "JScript"%>
<%
function showError(description)
{
%>
<html>
<body>
<p>
ERROR: <%=description%>
</p>
</body>
</html>
<%
}
function showHelp()
{
%>
<html>
<body>
Available Parameters: toemail,
fromemail, subject, content,
redirectto
</body>
</html>
<%
}
function getFormDataAsMsg(bUseHTML)
{
var dt = new Date();
var crlf = "\r\n";
if (bUseHTML) crlf = "<br>"
var strMailMsg = (dt.getMonth()+1) + "/" + dt.getDate() + "/"
+
dt.getFullYear() +crlf;
var arrFormVars = new
String(Request.Form("$formvars")).split(",");
for (i=0; i<arrFormVars.length; i++)
{
itemVal = new String(Request.Form(arrFormVars[i]));
if (bUseHTML)
{
if (itemVal != "undefined")
strMailMsg += "<b>[" + arrFormVars[i]
+ "]</b>:&nbsp;" + itemVal +
crlf;
else
strMailMsg += "<b>[" + arrFormVars[i]
+ "]</b>:&nbsp;" + crlf;
}
else
{
if (itemVal != "undefined")
strMailMsg += "[" + arrFormVars[i] +
"]: " + itemVal + crlf;
else
strMailMsg += "[" + arrFormVars[i] +
"]: " + crlf;
}
}
return strMailMsg;
}
function getFormDataAsCSV()
{
var strCSVLine = "";
var arrFormVars = new
String(Request.Form("$formvars")).split(",");
for (i=0; i<arrFormVars.length; i++)
{
var itemVal = new
String(Request.Form(arrFormVars[i]));
if (itemVal != "undefined")
{
var re1 = /\"/g;
var re2 = /\r\n/g;
var re3 = /\n/g;
strCSVLine += "\"" +
itemVal.replace(re1, "'").replace(re2, "
").replace(re3, " ") + "\"";
}
else
strCSVLine += "\"\"";
if (i<arrFormVars.length-1) strCSVLine
+= ",";
}
return strCSVLine;
}
function appendToFile(strFileName, strContent)
{
if (strFileName == '' || strFileName == undefined) strFileName
=
"default.txt";
strFileName = "d:/Web/WebDB/" + strFileName;
fs = new ActiveXObject("Scripting.FileSystemObject");
var bIsNewFile = false;
if (fs.FileExists(strFileName))
f = fs.GetFile(strFileName);
else
{
bIsNewFile = true;
fs.CreateTextFile(strFileName);
f = fs.GetFile(strFileName);
}
ts = f.OpenAsTextStream("8", "-2");
if (bIsNewFile)
{
ts.WriteLine(new String(Request.Form("$formvars")));
}
ts.WriteLine(strContent);
ts.Close( );
}
function sendMail(fromemail, toemail, subject, content)
{
var msg = new ActiveXObject("CDO.Message");
msg.From = fromemail;
msg.To = toemail;
msg.Subject = subject;
msg.TextBody = content;
Response.Write("*" + toemail);
msg.Configuration.Fields("http://schemas.microsoft.com/cdo/
configuration/smtpserver") = "10.0.4.9";
msg.Configuration.Fields("http://schemas.microsoft.com/cdo/
configuration/sendusing") = 2;
msg.Configuration.Fields.Update();
try
{
msg.Send();
}
catch(e)
{
showError("CDO.Message.Send() failed: " +
e.description);
return false;
}
return true;
}
var strSubject = new String(Request.Form("$subject"));
var strToEmail = new String(Request.Form("$toemail"));
var strRedirectURL = new String(Request.Form("$redirectto"));
var strFileName = new String(Request.Form("$saveas"));
appendToFile(strFileName, getFormDataAsCSV());
if (sendMail("info.requ...@www.softscape.com", strToEmail,
strSubject,
getFormDataAsMsg(false)))
Response.Redirect(strRedirectURL);
%>
Someone said it's a SPAM problem, but someone else says there's no
indication of
a SPAM problem in the headers of the blank emails.
Thanks much

Nov 11 '08 #1
1 2511
Lelu wrote:
Hi, My HTML form is generating some blank email
responses; does anyone see anything wrong with the scripts?:
This is c.i.w.a.html. If you don't know what HTML is, it's time to learn.

Please feel free to return when you have a question about HTML authoring for
the WWW. By that time, you have hopefully learned the importance of posting
a URL.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Nov 11 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jon Whittlestone | last post by:
hi there. I am getting two > characters and i really can't understand why they are there - see http://www.jonwhittlestone.co.uk/portfolio%20files/wminproperty/landlordAddProperty.php It is...
10
by: Piotr Wolski | last post by:
hello, as always i have a problem:-) i'm using HTML form. User is adding some date to this form and after that i'm generating plot. When plot is generated i can see en empty form and a plot. I...
7
by: Ed Lai | last post by:
A few weeks ago I have the idea of converting XML instance data to a HTML form, using tags as the label and the resulting form can be used to edit the XML data. So I started to play around with it,...
7
by: Alan Silver | last post by:
Hello, I am a complete and utter newbie at ASP.NET, so please forgive any stupid questions ;-) I am just trying to get my head around the whole web forms business, but have run into a...
7
by: webgreginsf | last post by:
Hello, I tried the following post a few weeks ago and never received any replies, so I figured I'd try again. I'm seeking suggestions for an interesting problem I have. I'm building a web...
10
by: Jake Forson | last post by:
Hi there, I'd like to re-create a form given only its resource file. I was going to simply read the resource file and re-create the "Form" object and all its controls as found in this file...
0
by: James Arnold | last post by:
I am trying to use a semi transparent PNG as the form background, allowing you to see through certain parts. The intention is similar to a skinnable form like launchy, with semi-transparent pixels...
7
by: Xh | last post by:
Hi All, I have problems with generating valid HTML output there are few HTML elements that i don't what to output as <tagname/> but as <tagname></tagnamebut Xalan keeps generating them as...
26
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.