Need help with outdated Contact Form Script
Hello,
I am working with Dreamweaver CS4 - Version 10 - still - and realize it is out of date. I manage a few websites, and have used Contact form scripts on all the sites which have worked successfully. The sites are hosted through different companies though. On one of the sites though, I am having an issue with the Contact form no longer working, and it appears to be a Dreamweaver contact form script that is the problem. The form no longer Submits or Resets, so there is either something wrong with the script which could be outdated, or it is somehow incompatible with the hosting service's server - but I don't really know. We are using Bluehost.com for hosting, and they don't give technical support for code on websites - they only host - so it is hard to know for sure why my Contact form is no longer working. I have verified that it isn't the email address - which is correctly coded into the submit button script. I am not sure if it is due to the age of my Dreamweaver program, and the script it generated for the form, so that is why I am posting here. Below I have copied and pasted the code so someone might take a look and let me know what they think. Dreamweaver inserted an 'onclick="MM_validateForm' script into the Submit button. This worked before, but maybe it no longer works - but I don't know. Below I have shown all the coding on the page, for the form, starting with the head section javascript.
In my <head> section of the website page, I have this javascript inserted, to make the form work:
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
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=document.getElementById(args);
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>
And here is the form script I am using in the <body> section of the page, shown below. The problem seems to occur with the Submit button, which doesn't initiate any action when the form is clicked and nothing happens when either the Submit or the Rest buttons are clicked.
Here is the specific code for both the Submit and the Reset buttons, contained within the overall form code below:
Submit button:
<input name="Submit2" type="submit" onclick="MM_validateForm('firstname','','R','lastname','','R','email','','RisEmail','TextArea','','R');return document.MM_returnValue" value="Submit" class="formbutton" />
Reset button:
<input type="reset" value="Reset" name="Reset2" class="formbutton"/>
The complete form code:
<form name="contactform" action="http://www.bluehost.com/bluemail" enctype="multipart/form-data" method="POST">
<blockquote>
<p align="left"><b>
<span class="formtitle"><br />
* First Name:</span></b>
<label>
<input name="firstname" type="text" class="textbox" id="firstname" size="30" maxlength="30" />
</label>
</p>
<p align="left">
<label><span class="formtitle">* Last Name:</span>
<input name="lastname" type="text" class="textbox" id="lastname" size="30" maxlength="30" />
</label>
</p>
<p align="left">
<label><span class="formtitle">Phone:</span>
<input name="phone" type="text" class="textbox" id="phone" size="15" maxlength="15" />
</label>
<label><span class="formtitle">ext.</span>
<input name="extension" type="text" class="textbox" id="extension" size="6" maxlength="6" />
</label>
<br />
<br />
<b><font color="#6699ff"
size="2"
face="Verdana, Arial, Helvetica, sans-serif" class="formtitle">* Email:</font></b>
<label>
<input name="email" type="text" class="textbox" size="25" maxlength="25" id="email" onblur="MM_validateForm('email','','RisEmail');return document.MM_returnValue" />
</label>
</p>
<p align="left"> </p>
<label name="checkbox">
</label>
<p align="left"><br />
<b><font color="#6699ff" size="2" face="Verdana, Arial, Helvetica, sans-serif" class="formtitle">Questions/Comments:</font></b><br />
<br />
<textarea name="TextArea" cols="40" rows="8" wrap="virtual" class="textbox" id="TextArea"></textarea>
</p>
<p align="left">
<input type="hidden" name="sendtoemail" value="me@myemail.com" /> [removed personal email address - Mod]
<input type="hidden" name="redirect" value="http://www.cjvolk.com/thankyou.html" />
<input name="Submit2" type="submit" onclick="MM_validateForm('firstname','','R','lastname','','R','email','','RisEmail','TextArea','','R');return document.MM_returnValue" value="Submit" class="formbutton" />
<input type="reset" value="Reset" name="Reset2" class="formbutton"/>
</p>
<p> </p>
</blockquote>
</form>
If someone can please tell me - is this a Dreamweaver code problem, where the code is out of date for the browsers now, or could it be some other issue? Does anyone have a suggestion, since I am using an older version of Dreamweaver as to the best way to update this code?
I appreciate anyone's input or answers - hope to get some help soon! Thank you very much!
Jackie
