473,240 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,240 software developers and data experts.

Mandatory Form Field not working - help needed!

24
The mandatory form field that is not working is the TYPE OF ILLUSTRATION.

[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 xxx_JScheckForm( f )
{

var sErrors = "";
var sfocusElements;
var aCheckFields = new Array();

aCheckFields[0] = "txt01_Name_of_Caller:::Name of Caller";
aCheckFields[1] = "txt02_Type_of_Caller:::Type of Caller";
aCheckFields[2] = "txt03_Company_Postcode:::Company Postcode";
aCheckFields[3] = "txt04_Tel_No:::Tel No";
aCheckFields[4] = "sel06_Type_of_Illustration:::Type of Illustration";
aCheckFields[5] = "txt07_Members_Name:::Members Name";
aCheckFields[6] = "txt08_Sex:::Date/Time";
aCheckFields[7] = "txt09_DOB:::DOB";
aCheckFields[8] = "txt10_Date_Joined_Service:::Date Joined Service";
aCheckFields[9] = "txt11_Selected_Retirement_Age:::Selected Retirement Age";
aCheckFields[10] = "txt12_Salary:::Salary";
aCheckFields[11] = "txt17_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;
}
//Check user has selected a Type of Illustration
if(f.sel06_Type_of_Illustration.value="Select"){
alert("You must select a Type of Illustration");
f.sel06_Type_of_Illustration.focus();
return false;
}

//Add GBP to Employer Contribution
//f.txt13_Employer_Contribution.value="GBP" + f.txt13_Employer_Contribution.value;
//f.txt14_Employee_Contribution.value="GBP" + f.txt14_Employee_Contribution.value;
alert(f.sel06_Type_of_Illustration.value);
processForm(f);
return true;
}

function doThis(foo) {
if(foo == "Option A") {
document.forms.frmSendMail.action = 'http://xxxx/include/xxxx/misc/xxxx/';
document.forms.frmSendMail.ctrlSendToEmailAddress. value = 'A@hotmail.co.uk';
document.getElementById('email').innerHTML = 'A@Hotmail.co.uk ';
document.getElementById('option').innerHTML = 'Monthly Payments Only ';
}
else {
if(foo == "Option B") {
document.forms.frmSendMail.action = 'http://xxxx/include/xxxx/misc/xxxx/';
document.forms.frmSendMail.ctrlSendToEmailAddress. value = 'B@hotmail.co.uk';
document.getElementById('email').innerHTML = 'B@hotmail.co.uk';
document.getElementById('option').innerHTML = 'One Off Payments ';
}

}
}



function processForm(oForm)
{



oForm.txt13_Employer_Contribution.value = "GBP " + oForm.txt13_Employer_Contribution.value;
oForm.txt14_Employee_Contribution.value = "GBP " + oForm.txt14_Employee_Contribution.value;
}

</script>



<FORM name="frmSendMail" action="" method="POST" onsubmit="return XXX_JScheckForm( this )">

<input type="hidden" name="ctrlSendToEmailAddress" value=""/>
<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="/xxxxxx/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 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">
REQUEST
</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">NAME OF CALLER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt01_Name_of_Caller"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TYPE OF CALLER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt02_Type_of_Caller"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">COMPANY POSTCODE</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt03_Company_Postcode"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TELEPHONE NUMBER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt04_Tel_No"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">PLAN NUMBER</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt05_Plan_No"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TYPE OF ILLUSTRATION</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><select size="1" name="sel06_Type_of_Illustration" onchange="doThis(this.value)">
<option value="Select">Select</option>
<option value="Option A">Option A</option>
<option value="Option B">Option B</option>
</select> *
</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">MEMBERS NAME</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt07_Members_Name"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">SEX</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt08_Sex"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">DATE OF BIRTH</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt09_DOB"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">DATE JOINED SERVICE</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt10_Date_Joined_Service"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">SELECTED RETIREMENT AGE</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt11_Selected_Retirement_Age"> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">SALARY</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><input type="text" name="txt12_Salary"> *</td>
</tr>


<TR>
<TD class="tableBackLightestBlue"></td>
<td class="tableBackLightestBlue" style="color: #CC0000"><p style="color: #CC0000" id="option"></p>
</td>
</tr>


<TR>
<TD class="tableBackLgtBlue2">EMPLOYER CONTRIBUTION</td>
<td class="tableBackLgtBlue2">GBP £ <input type="text" name="txt13_Employer_Contribution">
</tr>

<TR>
<TD class="tableBackLgtBlue2">EMPLOYEE CONTRIBUTION</td>
<td class="tableBackLgtBlue2">GBP £ <input type="text" name="txt14_Employee_Contribution"></td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">FUND CHOICE</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt15_Fund_Choice"></td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">START DATE</td>
<td class="tableBackLgtBlue2"><input type="text" name="txt16_Start_Date"></td>
</tr>

<tr>
<td class="tableBackLgtBlue2">COMMENTS</td>
<td class="tableBackLgtBlue2" style="color: #CC0000"><textarea name="txt17_Comments" cols="30" rows="4"></textarea> *</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">TIMES</td>
<td class="tableBackLgtBlue2">text to go here

</td>
</tr>

<TR>
<TD class="tableBackLgtBlue2">EMAIL RECIPIENT</td>
<td class="tableBackLgtBlue2"><p id="email"></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%">&nbsp;</td>
<td align="center">&nbsp; </td>
<td align="right" width="20%">
<INPUT TYPE="submit" class="xxxButton" value="SEND MAIL" />
</td>
</tr>
</table>
</td>
</tr>

</table>
</td>

</tr>
</table>

<br><br>

</FORM>
</body>
</html>[/HTML]
Aug 31 '07 #1
1 3351
ak1dnar
1,584 Expert 1GB
Check this out:

Change your codings to this way.

Expand|Select|Wrap|Line Numbers
  1. if(f.sel06_Type_of_Illustration.selectedIndex==0){
  2.         alert("You must select a Type of Illustration");
  3.         f.sel06_Type_of_Illustration.focus();
  4.         return false;
  5.     }
Aug 31 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: MT | last post by:
Hi all, this sounds like an easy enough thing to do, but after spending 45 minutes searching google and various javascript sites I can't find out how to make a textfield (textbox or whatever you...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
11
by: plumba | last post by:
Hi I have a user enolment form which is users fill out to let IT know that they need setting up on 'x' systems. When the user put a cross in the 'I would like Email' checkbox I would like the...
1
by: AR123 | last post by:
Hi I have set up mandatory form fields but it dosne t seem to be working. Would appreciate it if somone could have a look. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> ...
4
by: plumba | last post by:
Let me explain.... I have a form (most of which you guys have helped me with!!). The initial problem I was having is that it was holding the data in the fields after submit, I resolved this by...
1
by: mlshoats | last post by:
Hello I am trying to make a log to track questions i answer on little hardware problems. I got most of it working but I am very new to programming anything and just started picking up things. I am...
2
by: AR123 | last post by:
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...
3
by: Gaurav Jhamb | last post by:
I have 2-3 forms.On my first form when i serach to put any word it sends results and after that i click on new button in my search i got different organisation names. on the secong form i passed the...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.