Field functions are those that allow the user to work with HTML <INPUT>, <SELECT> objects. These functions include the ability to check the validity of an e-mail address, a date, an integer, or a floating point number.

Use

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_Globals.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_Character.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_String.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_Numeric.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_DateTime.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript" SRC="JS_Vision_Field.js"></SCRIPT>

Remarks

Bug Alert

Warning: In Netscape browsers, use of the fv functions in the onBlur attribute of the <INPUT> tag may cause a looping between the alert dialog box and the Web page field when an invalid value is entered in the field. One workaround is to use onChange rather that the onBlur attribute. This may require extra coding to check the field a second time when the user submits the form. This problem does not manifest itself when using Internet Explorer and is being investigated.

See the Netscape Bug Web page posted by JavaScript Vision.

The functions that are named with an fv (field validation) are designed to be used in the onBlur or onChange attribute of the <INPUT> tag since these functions take the object as input. For examples, see each of the fv functions.

The functions that are named with an fs (field script) are designed to be used in the user's JavaScript code, especially when writing a validation function for a form. For example, your call to the <FORM> tag may look like this:

<FORM NAME="MyTestForm" ACTION="myFormPost.cfm" METHOD="POST" onSubmit="return formCheck();">
<INPUT TYPE="Text" NAME="UserInteger" SIZE="5" MAXLENGTH="5">
<INPUT TYPE="Submit" NAME="fSubmit" VALUE="Submit">
</FORM>

and the JavaScript form validation code may look like this:

function formCheck() {
    if (JSV_fsInteger(document.MyTestForm.UserInteger.value) != VALID) {
        alert("Before the form can be submitted, " + 
            "an integer must be entered in the field.");
        return false;
    }
    else{
        return true;
    }
}

For more information on the SRC attribute of the SCRIPT tag, see JavaScript Vision Frequently Asked Questions.