CFFORM actually just renders a plain old FORM and javascript. You can even
write JS to interact with the generated JS to extend the functionality
(MINIMUM length for example...), but I found it a little unreliable and
generally just use regular FORMs and hand made JS.

Jim


-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 11, 2000 3:24 PM
To: CF-Talk
Subject: RE: Using JavaScript to validate non-<cfinput> fields in a
<cffor m>


> Is it possible to mix html form fields and <cfinput> fields 
> in a page and use JavaScript to validate the html form fields 
> while still using <cfform> validation for <cfinput> fields?

You can certainly do this. Here's an example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
        <title>Additional Validation</title>

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

function validateme(myform) {
        alert(myform.name);
        if (myform.mytextarea.value == '') {
                alert('textarea is empty!');
                return false;
        } else {
                return true;
        }
}

//-->
</SCRIPT>       

</head>

<body>

<cfform action="foo.cfm" onsubmit="return validateme(this);">

<textarea name="mytextarea"></textarea>

<br>

<input type="submit">

</cfform>

</body>
</html>

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to