Form Field Validation

Background

In a form field, if the field is validated using a call to a JavaScript function called from onBlur (see Code Sample 1) and the field data is invalid.

<INPUT TYPE="Text" NAME="MyDate" SIZE="10" MAXLENGTH="10"
       onBlur="JSV_fvDate(this,true);">
Code Sample 1

The JavaScript function called by onBlur displays an alert() when invalid data has been entered. Once the user clicks the OK button on the alert, the JavaScript function places focus back to the field that contains the invalid data.

Expected Sequence of Events

Using the test Web page, the proper sequence of events should be:

Place mouse cursor in field 1

Focus: Field1

Enter data in field 1
Place mouse cursor in field 2
Alert
Click OK


Blur: 1: field1
Focus: Field2
Blur: 1: field2
Focus: Field1

Note:
In the sequence of events above, user actions are indicated by the bold statements, and the results of the user's actions are indicated by the non-bold statements which are displayed in the lower frame of the test Web page.

Problem

Netscape Logo When the user clicks in the field with the invalid data using a mouse, Netscape goes into an infinite loop between the field and the alert(). Why? Netscape must assume that the mouse is placing the focus in the field when the focus is ALREADY in that field. The field then performs an onBlur of the field because the mouse is moving the focus from the field (put there by the JavaScript function) back to the same field.

Note:
When this errant behavior occurs using Netscape 3 or 4, the improper looping for the test Web page is limited to 12 iterations.

Remarks

This behavior has been reported to Netscape as of 4/23/1999 through their Navigator/Communicator Bug Report Form. As more information becomes available, that information will be posted on this page.

This bug creates problems when using the JavaScript Vision field functions using them to validate form fields.