I have a screen where certain textboxes get dynamically enabled or disabled depending on whether a value is entered in one of the textboxes (named TXBORGANISATIONNAME).
The textbox immediately following the Organisation name is a DateOfBirth field which gets disabled on blur event of Organisation name if any value is entered in it (org. name). This disabling is done by a Function organisationNameCheck() which is called onBlur and onChange event of OrganisationName textbox. In this event the focus should go to the next enabled field which is TXBPOSTCODE. But the focus is just lost..How do I get the focus on PostCode.???
Also when I clear the contents of OrgName, DateOfBirth Field is enabled so then the focus should go to DOB ..
For this I need to track the tab event (as in event of mouse click the focus should go to the field where the mouse is clicked) which I am not able to trap within the organisationNameCheck() function as it is called on change or blur events..
I am able to trap the event and code a work-around in IE 6 version.. but it fails in IE 5 &5.5 versions.. Therefore I would like to get solutions for IE 5-5.5 versions at the earliest.
The follwing is a part of my Jsp and Jscript.
<Script language="JavaScript">
function organisationNameCheck() {
if (document.JSP.TXBORGANISATIONNAME.value == "")
{
changeStyleSheetClass(document.JSP.TXBDATEOFBIRTH, 'E'); // Enabling
//TXBDATEOFBIRTH
document.all["LBLTXBDATEOFBIRTH"].className="mainLabel";
changeStyleSheetClass(document.JSP.TXBBANKGIRO, 'E');
document.all["LBLTXBBANKGIRO"].className="mainLabel";
changeStyleSheetClass(document.JSP.LSBSEX, 'E');
document.all["LBLLSBSEX"].className="mainLabel";
}
else
{
changeStyleSheetClass(document.JSP.TXBDATEOFBIRTH, 'D'); // Disabling
//TXBDATEOFBIRTH
document.all["LBLTXBDATEOFBIRTH"].className="mainLabelDisabled";
document.JSP.TXBDATEOFBIRTH.value="";
changeStyleSheetClass(document.JSP.TXBBANKGIRO, 'D');
document.all["LBLTXBBANKGIRO"].className="mainLabelDisabled";
document.JSP.TXBBANKGIRO.value="";
changeStyleSheetClass(document.JSP.LSBSEX, 'D');
document.all["LBLLSBSEX"].className="mainLabelDisabled";
document.JSP.LSBSEX.value="";
}
}
</Script>
<body class="background" onkeydown="javascript: void checkKeyPressed();" onLoad="organisationNameCheck();postCodeCheck();callOnLoad();" text="#000000">
<!-- #BeginEditable "Page Specific Javascript" --> <!-- #EndEditable -->
<form method="post" name="JSP" action='imsearchforclient'>
.
.
.
<td class=mainLabel>
<input type="text" name="TXBORGANISATIONNAME" class="<Process:ClientSearch name="CSS_TXBORGANISATIONNAME_ENB"/>"
value="<Process:ClientSearch name="TXBORGANISATIONNAME" />" onChange ="organisationNameCheck();" onblur="organisationNameCheck();" >
</td>
<td width="10"> </td>
<td class=mainLabel>
<input type="text" name="TXBDATEOFBIRTH" maxlength="70" class="<Process:ClientSearch name="CSS_TXBDATEOFBIRTH_ENB"/>"
value='<Process:ClientSearch name="TXBDATEOFBIRTH" />'
</td>
<td class=mainLabel>
<input type="text" name="TXBPOSTCODE" class="<Process:ClientSearch name="CSS_TXBPOSTCODE_ENB"/>"
value="<Process:ClientSearch name="TXBPOSTCODE" />" onChange="postCodeCheck();">
</td>
<td class=mainLabel>
<input type="text" name="TXBBANKGIRO" class="<Process:ClientSearch name="CSS_TXBBANKGIRO_ENB"/>"
value="<Process:ClientSearch name="TXBBANKGIRO" />" >
</td>
<td class=mainLabel>
<select name="LSBSEX" class="<Process:ClientSearch name="CSS_LSBSEX_ENB"/>" >
<Process:ClientSearch name="LSBSEX" />
</select>
</td>
.
.
.
</form>
</body>
The textbox immediately following the Organisation name is a DateOfBirth field which gets disabled on blur event of Organisation name if any value is entered in it (org. name). This disabling is done by a Function organisationNameCheck() which is called onBlur and onChange event of OrganisationName textbox. In this event the focus should go to the next enabled field which is TXBPOSTCODE. But the focus is just lost..How do I get the focus on PostCode.???
Also when I clear the contents of OrgName, DateOfBirth Field is enabled so then the focus should go to DOB ..
For this I need to track the tab event (as in event of mouse click the focus should go to the field where the mouse is clicked) which I am not able to trap within the organisationNameCheck() function as it is called on change or blur events..
I am able to trap the event and code a work-around in IE 6 version.. but it fails in IE 5 &5.5 versions.. Therefore I would like to get solutions for IE 5-5.5 versions at the earliest.
The follwing is a part of my Jsp and Jscript.
<Script language="JavaScript">
function organisationNameCheck() {
if (document.JSP.TXBORGANISATIONNAME.value == "")
{
changeStyleSheetClass(document.JSP.TXBDATEOFBIRTH, 'E'); // Enabling
//TXBDATEOFBIRTH
document.all["LBLTXBDATEOFBIRTH"].className="mainLabel";
changeStyleSheetClass(document.JSP.TXBBANKGIRO, 'E');
document.all["LBLTXBBANKGIRO"].className="mainLabel";
changeStyleSheetClass(document.JSP.LSBSEX, 'E');
document.all["LBLLSBSEX"].className="mainLabel";
}
else
{
changeStyleSheetClass(document.JSP.TXBDATEOFBIRTH, 'D'); // Disabling
//TXBDATEOFBIRTH
document.all["LBLTXBDATEOFBIRTH"].className="mainLabelDisabled";
document.JSP.TXBDATEOFBIRTH.value="";
changeStyleSheetClass(document.JSP.TXBBANKGIRO, 'D');
document.all["LBLTXBBANKGIRO"].className="mainLabelDisabled";
document.JSP.TXBBANKGIRO.value="";
changeStyleSheetClass(document.JSP.LSBSEX, 'D');
document.all["LBLLSBSEX"].className="mainLabelDisabled";
document.JSP.LSBSEX.value="";
}
}
</Script>
<body class="background" onkeydown="javascript: void checkKeyPressed();" onLoad="organisationNameCheck();postCodeCheck();callOnLoad();" text="#000000">
<!-- #BeginEditable "Page Specific Javascript" --> <!-- #EndEditable -->
<form method="post" name="JSP" action='imsearchforclient'>
.
.
.
<td class=mainLabel>
<input type="text" name="TXBORGANISATIONNAME" class="<Process:ClientSearch name="CSS_TXBORGANISATIONNAME_ENB"/>"
value="<Process:ClientSearch name="TXBORGANISATIONNAME" />" onChange ="organisationNameCheck();" onblur="organisationNameCheck();" >
</td>
<td width="10"> </td>
<td class=mainLabel>
<input type="text" name="TXBDATEOFBIRTH" maxlength="70" class="<Process:ClientSearch name="CSS_TXBDATEOFBIRTH_ENB"/>"
value='<Process:ClientSearch name="TXBDATEOFBIRTH" />'
</td>
<td class=mainLabel>
<input type="text" name="TXBPOSTCODE" class="<Process:ClientSearch name="CSS_TXBPOSTCODE_ENB"/>"
value="<Process:ClientSearch name="TXBPOSTCODE" />" onChange="postCodeCheck();">
</td>
<td class=mainLabel>
<input type="text" name="TXBBANKGIRO" class="<Process:ClientSearch name="CSS_TXBBANKGIRO_ENB"/>"
value="<Process:ClientSearch name="TXBBANKGIRO" />" >
</td>
<td class=mainLabel>
<select name="LSBSEX" class="<Process:ClientSearch name="CSS_LSBSEX_ENB"/>" >
<Process:ClientSearch name="LSBSEX" />
</select>
</td>
.
.
.
</form>
</body>