My form calls an onsubmit function to check fields for completion (validation check).
Here is a breakdown version of the form:
[HTML]<html>
<script>
function toggle_display() {
var form = document.getElementById('hidesubmit');
var submit = document.getElementById('submit_group');
((form.checked)? submit.style.display='block': submit.style.display='none');
}
</script>
<script>
function toggle_form() {
var form = document.getElementById('e_form');
var thanks = document.getElementById('THANKS');
form.style.display ='none';
thanks.style.display='block';
}
</script>
<script language="JavaScript">
<!--
[/html]
Expand|Select|Wrap|Line Numbers
- function formCheck(formobj){
- // Enter name of mandatory fields
- var fieldRequired = Array("Manager_Name");
- // Enter field description to appear in the dialog box
- var fieldDescription = Array("First Name");
- // dialog message
- var alertMsg = "Please complete the following fields:\n";
- var l_Msg = alertMsg.length;
- for (var i = 0; i < fieldRequired.length; i++){
- var obj = formobj.elements[fieldRequired[i]];
- if (obj){
- switch(obj.type){
- case "select-one":
- if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- break;
- case "select-multiple":
- if (obj.selectedIndex == -1){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- break;
- case "text":
- case "textarea":
- if (obj.value == "" || obj.value == null){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- break;
- default:
- }
- if (obj.type == undefined){
- var blnchecked = false;
- for (var j = 0; j < obj.length; j++){
- if (obj[j].checked){
- blnchecked = true;
- }
- }
- if (!blnchecked){
- alertMsg += " - " + fieldDescription[i] + "\n";
- }
- }
- }
- }
- if (alertMsg.length == l_Msg){
- return true;
- }else{
- alert(alertMsg);
- return false;
- }
- }
// -->
</script>
</head>
<body>
<div id="THANKS" style="display:none;">
<p>Thank you for submitting an e-Enrolment Form.
<a href="#" onClick="window.close();">Close</a>
</div>
<p> <form method="post" action="mailto:mail@web.co.uk?subject=EnrolReq" enctype="text/plain" subject="New User" name="FrontPage_Form1" onsubmit="return formCheck(this);" id="e_form" language="JavaScript" style="display:block;"> </div>
<table border="0" width="72%" id="table2" bgcolor="#FFFFCC">
<tr>
<td align="right" width="37%"><font size="2">Name:</font></td><td align="left" width="62%"> <input type="text" name="Manager_Name" size="36" tabindex="1"><font color="#FF0000">*</font></td></tr>
<input type="checkbox" name="agreecheck" id="hidesubmit" value="Agreed" onClick="toggle_display();"/>
By placing a check in the box you are agreeing to the above Access Authorisation Statement.</font></b></p>
<div id="submit_group" style="display:none;">
<table border="0" width="70%" id="table22" bgcolor="#CCFFFF">
<tr>
<td>
<p align="center"><font size="2">When you click 'Submit' a screen will pop up indicating a program is sending an Email on your behalf.<br>
<b>You must click YES to submit the form.</b></font></td>
</tr>
</table>
<p>
<input type="hidden" name="EOR" value="">
<input type="Submit" value="Submit!">
<input type="reset" value="Clear Form">
</p>
</div>
</form>
</body>
</html>[/HTML]
I think the problem is somthing to do with the [HTML]<form method="post" action="mailto:mail@web.co.uk?subject=EnrolReq" enctype="text/plain" subject="New User" name="FrontPage_Form1" onsubmit="return formCheck(this);" id="e_form" language="JavaScript" style="display:block;"> </div>[/HTML] line.
HOWEVER........ it works ok when I preview it in my html editor, it's only when it's run through IE v6, it seems to just ignore the field validation.
Suggestions........