• After more than 30 years running websites and forums I am retiring.

    I have made many friends through the years. I will cherish my time getting to know you. I wish you all the best. This was not an easy decision to make. The cost to keep the communities running has gotten to the point where it's just too expensive. Security certificates, hosting cost, software renewals and everything else has increased threefold. While costs are up ad revenue is down. It's no longer viable to keep things running.

    All sites will be turned off on Thursday 30 November 2023. If you are interested in acquiring any of the websites I own you can Email Schwarz Network.

Problem with setting Focus on dynamically enabled/disabled textfields in IE 5-5.5

Juice

Newcomer
Joined
May 23, 2003
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>
 
Top Bottom