I have a form (see below), which for some reason has decided to stop functioning all together. It just does not call up the function. It is called up in the opening <form> tag but fails.... Any ideas???
[HTML]<html>
<head><title>New Details</title>
</head>
<center>
<H2><IMG SRC="$(path)smlogo.gif"><br>
Form No EN$(FORMNO)
<br>
</h2>
[/html]
Expand|Select|Wrap|Line Numbers
- <script>
- <!--
- //Script to check form for mandatory fields and for flexi details
- function formCheck(formobj){
- // Enter name of mandatory fields
- var fieldRequired = Array("Manager_Name", "Manager_Email", "Date_Required", "Surname", "Forename", "Tel_No", "Job_Title", "Job_TitleW", "Section", "SectionW");
- // Enter field description to appear in the dialog box
- var fieldDescription = Array("Managers Name", "Managers Email", "Date Required", "Surname", "Forename", "Telephone Number", "Job Title", "Welsh Job Title", "Section", "Welsh Section");
- // 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){
- toggle_form();
- }else{
- alert(alertMsg);
- return false;
- }
- var flexi = document.FrontPage_Form1.Flexi_Time;
- var flexidate = document.FrontPage_Form1.Flexi_Start_Date
- var fleximanager = document.FrontPage_Form1.Flexi_Manager
- if (flexi.value="Yes" && flexidate.value="") {alert("Please enter Flexi Start Date")}
- flexidate.focus();
- return false;
- else {return true;}
- if (flexi.value="Yes" && fleximanager.value="") {alert("Please enter flexi Supervisor ID")}
- fleximanager.focus();
- return false;
- else {return true;}
- }
- // -->
- </script>
- <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>
- // Script to check Email address is valid
- function emailvalidation(entered, alertbox)
- {
- with (entered)
- {
- apos=value.indexOf("@");
- dotpos=value.lastIndexOf(".");
- lastpos=value.length-1;
- if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
- {if (alertbox) {alert(alertbox);} return false;}
- else {return true;}
- }
- }
- </script>
</head>
<body>
<div id="THANKS" style="display:none;">
<table border="0" width="72%" id="table25">
<tr>
<td align="center" width="887">
<img border="0" src="_borders/conwyLogo.gif" width="97" height="64" align="right"></td>
</tr>
<tr>
<td align="center" width="887"><b>Thank you for submitting an e-Enrolment Form.</b></td>
</tr>
<tr><td align="center" width="887">Use the form number (above) if you need to chase the progress of the enrolent</td>
</tr>
<tr>
</tr>
<tr>
<td align="center" width="887">Please allow 3 full working days before chasing progress.</td>
</tr>
</tr>
<tr>
<td align="center" width="887">You may now
<a href="#" onClick="window.close();">Close</a> this window.</td>
</tr>
</table>
</div>
<form method="post" action="mailto:__MUNGED__?subject=test enctype="text/plain" subject="New User" name="FrontPage_Form1" onsubmit="return formCheck(this);" id="e_form" language="JavaScript" style="display:block;"> </div>
<table width="752">
<tr>
<td width="79%">
<p align="center"> </td>
</tr>
</table>
<table border="0" width="72%" id="table2" bgcolor="#FFFFCC">
<tr>
<td align="right" width="37%">
<p align="left"><font color="#0000FF"><b>Step 1 - Line
Managers Details.</b></font></td>
<td align="left" width="62%">
</td>
</tr>
<tr>
<td align="right" colspan="2">
<p align="left"><font size="2"><b>This should be the details
of the line manager requesting this e-Enrolment.</b></font></td>
</tr>
<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>
<tr>
<td align="right" width="37%">
<font size="2">Job Title:</font></td>
<td align="left" width="62%">
<input type="text" name="Manager_Job_Title" size="36" tabindex="2"></td>
</tr>
<tr>
<td align="right" width="37%">
<font size="2">Email Address:</font></td>
<td align="left" width="62%">
<input type="text" name="Manager_Email" size="36" tabindex="3" onChange="emailvalidation(this, 'Email address is invalid');"><font color="#FF0000">*</font></td>
</tr>
<input type="radio" name="Flexi_Time" value="Yes"></font></td>
<td align="center" width="19%">
</td>
</tr>
<tr>
<td width="95%" colspan="5">
<p align="center"><b><font size="2">Flexi Attendance Details</font></b></td>
</tr>
<tr>
<td width="45%" colspan="2">
<p align="center"><font size="2">Start recording from (dd/mm/yy)</font></td>
<td width="53%" align="center" colspan="3">
<font size="2">User ID of Person Monitoring Flexi</font></td>
</tr>
<tr>
<td width="45%" colspan="2">
<p align="center">
<input type="text" name="Flexi_Start_Date" size="10" maxlength="8"></td>
<td width="53%" align="center" colspan="3">
<input type="text" name="Flexi_Manager" size="10" maxlength="8" style="text-transform: uppercase"></td>
</tr>
</table>
<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">You may now click the SUBMIT button to
submit your e-Enrolment.</font><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="Submit" value="Submit!">
<input type="reset" value="Clear Form">
</p>
</div>
<textarea rows="7" name="Authority" cols="30" style="width:753; font-weight:bold; height:116; font-family:Arial" wrap=virtual>ACCESS AUTHORISATION
I certify that the above named user (being an Employee or Agency Worker) has signed the relevant Induction Programme Form to confirm that they have been issued with, read and understood the Corporate Information Security Policy and, where applicable, the Email and Internet Policies
I understand that failure to do so could result in disciplinary action.
</textarea><br>
<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>
<input type="hidden" name="EOR" value="">
</form>
<p> </p>
<p> </p>
</body>
</html>
</table>
</table>[/HTML]
Basically, the form should validate the fields are filed out correctly then unhide the submit button, when the submit button is pressed it hides the form and just displays a thank you.
It shouls aldo check the 'Flexi' radio button which if is yes then checks the next two fields are filled out.
Hope all that makes sense...
Any help would be grreatly appreciated..
One question.... what is the difference between putting the script in <!-- and --> or just inside the <script> tags??