Looks to me like you have the function checkForm() commented out  <!--- with a 
CF comment.  If you are trying to hide it from browsers that don't recognize 
javascript, use the HTML comment <!--  (the number of dashes really do matter). 
 I noticed you have a javascript commenter '//' before the closing CF comment, 
but keep in mind the CF comments are processed on the server side, and 
javascript comments are only there on the client side.

Dave

-----Original Message-----
From: King, Chris [mailto:[EMAIL PROTECTED]
Sent: Friday, July 22, 2005 10:53 AM
To: CF-Newbie
Subject: form validation


Hello, all. I am trying to do some form validation, but it isn't
working. Instead of giving me the alert, it takes me to the action page,
no matter what I type in. I basically took this code straight from a
book. Any ideas? Thanks.

 

<html>

<head>

 

<script language="JavaScript">

<!---

function checkForm() {

            var ValidPassed = True;

            while (ValidPassed==True) {

                        if (!document.fBuyout.varFname.value.length) {

                                    alert("Enter First Name.");

                                    document.fBuyout.varFname.focus();

                                    ValidPassed=false;

                                    break;

                        }

                        break;

            }

            Return ValidPassed;

}

// --->

</script>

</head>

<body>

 

      <cfoutput>

            <cfform action="buyoutaddaction.cfm" method="post"

                        name="fBuyout" onSubmit="return checkForm()">

              <table>

                <tr>

                  <td>

                        <cfinput type="text" name="varFname"

                                    size="10" maxlength="10" value="">

                  </td>

                  <td>

                    <input type="Submit" value="ok">

                  </td>

                </tr>

          </table>

            </cfform>

      </cfoutput>

 

</body>

</html>

 

Chris King

Desktop Support Specialist / Winbatch Guru

Atos Origin

301 University Blvd

1.710 Rebecca Sealy

Galveston, TX 77555

USA

Phone : 409.747.9428

Fax : 409.747.9569

[EMAIL PROTECTED]

[EMAIL PROTECTED]

www.atosorigin.com

 

"Never test for an error you don't know how to handle."

 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get Instant Hacker Protection, Virus Detection, Antispam & Personal Firewall.
http://www.houseoffusion.com/banners/view.cfm?bannerid=62

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1319
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to