Hi I have set up a form. What I want to to is with the fields:
Company Postcode
Agency Number
Policy Number
I want these to be mandatory however if someone fills in the company postcode for example the other two fields dont need to be filled in. I just put a line of text in saying: Please ensure either Company Postcode, Agency Number or Policy Number is filled in. but this is not really working well as people are still leaving it blank and they need to able to have the option to fill either or but they need to be mandatory but not, if you know what I mean?
Code below:
[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Proforma</title>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<script language="javascript">
function ABC_JScheckForm( f )
{
var sErrors = "";
var sfocusElements;
var aCheckFields = new Array();
aCheckFields[0] = "txt02_Name_of_Caller:::Name of Caller";
aCheckFields[1] = "txt03_Type_of_Caller:::Type of Caller";
aCheckFields[2] = "txt06_Tel_No:::Tel No";
aCheckFields[3] = "txt11_Comments:::Comments";
// Loop through each field identified as mandatory
for ( var i = 0; i < aCheckFields.length; i++ )
{
var aData = aCheckFields[i].split( /\:\:\:/ );
var oFormElement = eval( "f." + aData[0] );
if ( oFormElement.value.match( /^\s*$/ ) )
{
sErrors += aData[1] + "\n";
if ( ! sfocusElements ) { sfocusElements = aData[0]; }
}
}
if ( sErrors )
{
alert( "The following fields are required - \n\n" + sErrors );
eval( "f." + sfocusElements + ".focus()" );
return false;
}
return true;
}
</script>
<FORM name="frmSendMail" action="http://xxxxxxx/sendmail/" method="POST" onsubmit="return ABC_JScheckForm( this )">
<input type="hidden" name="ctrlSendToEmailAddress" value="Email@email.com=>Proforma"/>
<input type="hidden" name="ctrlEmailSubject" value="Proforma" />
<input type="hidden" name="ctrlMethod" value="E-MAIL" />
<input type="hidden" name="ctrlFromEmailAddress" value=""/>
<input type="hidden" name="ctrlRedirectURL" value="xxxx/xxxxx/submit/" />
<table width="90%" border="0" cellspacing="0" cellpadding="0" bgcolor="8ED1E6">
<tr>
<td valign="top" align="left">
<table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="8ED1E6" align="center">
<tr valign="top" align="left">
<td class="tableBackLightestBlue" colspan="2" height="27">
<p class="pageHead">
<p style="color: #CC0000">Fields marked with * are mandatory</p>
</td>
</tr>
<!-- start of form details -->
<TR>
<TD class="tableBackLgtBlue2">EMAIL TYPE</td>
<td class="tableBackLgtBlue2"><select size="1" name="sel01_Email type">
<option value="Select">Select</option>
<option value="CALLBACK">CALLBACK</option>
<option value="INFO REQUEST">INFO REQUEST</option>
</select>
</td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">NAME OF CALLER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt02_Name_of_Caller"> *</td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">TYPE OF CALLER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt03_Type_of_Caller"> *</td>
</tr>
<TR>
<TD class="tableBackLightestBlue" colspan="2" height="27" style="color: #CC0000" align="center">Please ensure either <b>Company Postcode</b>, <b>Agency Number</b> or <b>Policy Number</b> is filled in.</TD>
</TR
<TR>
<TD class="tableBackLgtBlue2">COMPANY POSTCODE</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt04_Company_Postcode"></td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">AGENCY NUMBER</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt05_Agency_Number"></td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">TELEPHONE NUMBER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt06_Tel_No"> *</td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">FAX NUMBER</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt07_Fax_No"></td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">POLICY NUMBER</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt08_Policy_No"></td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">HANDLER</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt09_handler"></td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">EMAIL ADDRESS</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt10_Email_Address"></td>
</tr>
<tr>
<td class="tableBackLgtBlue2">COMMENTS</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><textarea name="txt11_Comments" cols="30" rows="4"></textarea> *</td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">TURNAROUND TIMES</td>
<td class="tableBackLgtBlue2">Turn around time 24 Hours for all callbacks.
</td>
</tr>
<TR>
<TD class="tableBackLgtBlue2">EMAIL RECIPIENT</td>
<td class="tableBackLgtBlue2"><p>Email@email.com</p></td>
</tr>
<tr valign="top" align="left">
<td class="tableBackLgtBlue2" colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="19">
<tr valign="top" align="left">
<td width="20%"> </td>
<td align="center"> </td>
<td align="right" width="20%">
<INPUT TYPE="submit" class="abcButton" value="SEND MAIL" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br><br>
</FORM>
</body>
</html>[/HTML]