Try the following :


<script language="JavaScript">
function checkForm() {
    var formObj = document.form1;
    var length = formObj.formFieldName.length;

    if (length > 45) {
        alert('formField must be less than 45 characters in length');
        formObj.formFieldName.focus();
        return false;
    else
        return true;
</script>

<form name="form1" onSubmit="return checkForm();">
...
...
...
</form>



----- Original Message -----
From: "Doyle, Mike" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, November 10, 2000 4:02 AM
Subject: RE: Form Validate????


> Yes.  You can run a javascript function which checks the stringName.length
> property upon submission of form field.
>
> Mike
> "Room service!?  Send up a larger room!" -Groucho Marx
>
> -----Original Message-----
> From: Auction Hard Drive [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 09, 2000 12:31 PM
> To: CF-Talk
> Subject: Form Validate????
>
>
> Is there any way to validate a form field field so it is limited to 45
> characters?
>
>
> Thanks,
> Rich
>
> --------------------------------------------------------------------------
--
> --------------------
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send
a
> message with 'unsubscribe' in the body to
[EMAIL PROTECTED]
> --------------------------------------------------------------------------
----------------------
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send
a message with 'unsubscribe' in the body to
[EMAIL PROTECTED]

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to