Hi
I am mailing a form using the JMail component, when the form is sent the form fields are in apparently random order.
At first I thought it was because I was using a table for layout however after removing the table the results are still the same.......?
I have appended the form, the sendmail page and the e-mail results below.
Any pointers would be welcomed.
TIA
registration.asp
regmail.asp
and the results
A1_Title: Mr
Company:
Comments:
A1_First_Name:
Finance_Manager:
A1_Last_Name:
Range_Of_Service:
A1_Position:
A2_Title: Mr
A2_Last_Name:
SD:
A2-First_Name:
OP_Contact:
A2_Position:
Website: http://
Fax:
MD:
Department_Project:
Address2:
submit: Submit
EMail:
Address3:
Date: 29/02/2004
Telephone:
QHSE_Contact:
Address1:
Management_Contacts:
Postcode:
country:
I am mailing a form using the JMail component, when the form is sent the form fields are in apparently random order.
At first I thought it was because I was using a table for layout however after removing the table the results are still the same.......?
I have appended the form, the sendmail page and the e-mail results below.
Any pointers would be welcomed.
TIA
registration.asp
Code:
<%@LANGUAGE = VBSCRIPT%>
<html>
<head>
<%
'Use this code freely. Just remember me when you're recruiting!
'Dave Lohmann dloh@uk2.net
Sub ShowUKdate()
dim dateStr, UKdate
dateStr=split(date,"/")
'add leading zero to single figures
if Len(dateStr(0))<2 then
dateStr(0)="0"&dateStr(0)
end if
if Len(dateStr(1))<2 then
dateStr(1)="0"&dateStr(1)
end if
if Int(dateStr(0))=month(now) then
UKdate=dateStr(1)&"/"&dateStr(0)&"/"&dateStr(2)
else
UKdate=join(dateStr,"/")
end if
response.write UKdate
End Sub
%>
<title>Signup Request Form</title>
<link href="style/touk.css" rel="stylesheet" type="text/css">
<script language="JavaScript" 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>
</head>
<body>
<form action="regmail.asp" method="post" onSubmit="MM_validateForm('2','','R','3','','R','9','','R','13','','R','14','','R');return document.MM_returnValue">
<p align="center"><img src="images/sm_logotechnip.jpg"></p>
<h2>Registration<br>
<img src="images/background.gif" width="100%" height="2"> </h2>
<p> Please complete the registration details below; </p>
<strong>Attendees</strong>
<p><strong>Attendee 1</strong><br>
</p>
<p> Title<br>
<select name="A1_Title" id="1">
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Dr">Dr</option>
<option value="Rev">Rev</option>
<option value="Lord">Lord</option>
</select>
<br>
</p>
<p> Attendee 1 - First Name<br>
<input name="A1_First_Name" type="text" id="2">
<br>
</p>
<p> Attendee 1 - Last Name<br>
<input name="A1_Last_Name" type="text" id="3">
<br>
</p>
<p> Attendee 1 - Position / Job Title<br>
<input name="A1_Position" type="text" id="4" size="40">
<br>
<br>
<strong>Attendee 2</strong><br>
</p>
<p> Title <br>
<select name="A2_Title" id="5">
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
<option value="Miss">Miss</option>
<option value="Dr">Dr</option>
<option value="Rev">Rev</option>
<option value="Lord">Lord</option>
</select>
<br>
</p>
<p> Attendee 2 - First Name<br>
<input name="A2-First_Name" type="text" id="6">
<br>
</p>
<p> Attendee 2 - Last Name<br>
<input name="A2_Last_Name" type="text" id="7">
<br>
</p>
<p> Attendee 2 - Position / Job Title<br>
<input name="A2_Position" type="text" id="8" size="40">
<br>
</p>
<p> <strong>Company Details</strong><br>
</p>
<p> Company<br>
<input name="Company" type="text" id="9" size="40">
<br>
<br>
</p>
<p> Range of Services<br>
<textarea name="Range_Of_Service" cols="40" id="10"></textarea>
<br>
</p>
<p> Department / Project<br>
<input name="Department_Project" type="text" id="11" size="40">
<br>
</p>
<p> Company Website<br>
<input name="Website" type="text" id="12" value="[URL unfurl="true"]http://"[/URL] size="40">
<br>
</p>
<p> Contact EMail Address<br>
<input name="EMail" type="text" id="13" size="40">
<br>
</p>
<p> Contact Telephone Number<br>
<input name="Telephone" type="text" id="14" size="40">
<p> Contact Fax Number<br>
<input name="Fax" type="text" id="15" size="40">
<br>
<br>
Company Business Address<br>
<input name="Address1" type="text" id="16" size="40">
</p>
<p> City<br>
<input name="Address2" type="text" id="17" size="40">
<br>
</p>
<p>Region / County<br>
<input name="Address3" type="text" id="18" size="40">
</p>
<p>Zip / Post Code<br>
<input name="Postcode" type="text" id="19" size="10">
</p>
<p>Country<br>
<select name="country" id="20">
<option value="">Country...</option>
<option value="United Kingdom">United Kingdom</option>
<option value="Afganistan">Afghanistan</option>
<option value="Lots Deleted">Lots Deleted</option>
<option value="Zambia">Zambia</option>
<option value="Zimbabwe">Zimbabwe</option>
</select>
</p>
<p>Management Contacts<br>
<textarea name="Management_Contacts" cols="40" id="21"></textarea>
</p>
<p>QHSSE Contact<br>
<textarea name="QHSE_Contact" cols="40" id="22"></textarea>
</p>
<p>Finance Manager<br>
<textarea name="Finance_Manager" cols="40" id="22"></textarea>
</p>
<p>Managing Director<br>
<input name="MD" type="text" id="23">
</p>
<p>Sales Director<br>
<input name="SD" type="text" id="24">
</p>
<p>Operational Contact<br>
<input name="OP_Contact" type="text" id="24">
</p>
<p> Are you registered with ABCD<br>
Yes
<input name="ABCD" type="radio" value="Yes" id="25">
No
<input name="ABCD" type="radio" value="No" id="25">
</p>
<p>Have you completed your DEF registration?<br>
Yes
<input name="DEF" type="radio" value="Yes" id="26">
No
<input name="DEF" type="radio" value="No" id="26">
</p>
<p> Please add any additional comments or requests for items you would<br>
like to see covered at the event.<br>
<textarea name="Comments" cols="40" rows="4" id="27"></textarea>
</p>
<p>
<input name="Date" type="text" id="28" value="<% ShowUKdate %>" size="10">
</p>
<p>
<input name="submit" type="submit" value="Submit">
</p>
<p><img src="images/background.gif" width="100%" height="2"></p>
</form>
</body>
</html>
regmail.asp
Code:
<%@LANGUAGE = VBSCRIPT%> <html>
<link href="style/touk.css" rel="stylesheet" type="text/css">
<body>
<p> </p>
<table width="80%" border="0" align="center">
<tr>
<td><%
' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )
' Set logging to true to ease any potential debugging
' And set silent to true as we wish to handle our errors ourself
msg.Logging = true
msg.silent = true
' Most mailservers require a valid email address
' for the sender
msg.From = "something@something.com"
msg.FromName = "Online Registration Form"
' Note that as addRecipient is method and not
' a property, we do not use an equals ( = ) sign
msg.AddRecipient "something@something.com", "Registration Signup"
' The subject of the message
msg.Subject = "Registration Request"
'add every form element and its value to the email
FOR EACH el IN Request.Form
msg.appendtext( el & ": " & Request.form(el) & vbcrlf )
NEXT
' Now send the message, using the indicated mailserver
if not msg.Send("deleted" ) then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.write "Registration Request sent succesfully! <br>"
Response.Write "Once validated blah blah Ltd will confirm your attendance <br>"
end if
' And we're done! the message has been sent.
%></td>
</tr>
<tr>
<td><a href="[URL unfurl="true"]http://blahblah.com/registration.asp">Click[/URL] here to
return to the start.</a></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
and the results
A1_Title: Mr
Company:
Comments:
A1_First_Name:
Finance_Manager:
A1_Last_Name:
Range_Of_Service:
A1_Position:
A2_Title: Mr
A2_Last_Name:
SD:
A2-First_Name:
OP_Contact:
A2_Position:
Website: http://
Fax:
MD:
Department_Project:
Address2:
submit: Submit
EMail:
Address3:
Date: 29/02/2004
Telephone:
QHSE_Contact:
Address1:
Management_Contacts:
Postcode:
country: