|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help! I'm trying to run a form validation with the following code, but I get an "object expected" error when I run it.
<SCRIPT language="JavaScript"> <!-- function CheckCC(stupidform) { var CCok = true var mystring = stupidform.cnum.value var strlen = stupidform.cnum.value.length for (i=0; i< strlen; i++) { if(mystring.charAt(i) == "-") { CCok = false alert('No Dashes! Please enter your credit card in the form 1111222233334444'); //Temp.focus() i=strlen } if(mystring.charAt(i) == ".") { CCok = false alert('No Periods! Please enter your credit card in the form 1111222233334444'); //Temp.focus() i=strlen } if(mystring.charAt(i) == " ") { CCok = false alert('No Spaces seperating Numbers! Please enter your credit card in the form 1111222233334444'); //Temp.focus() i=strlen } } if(strlen != 16) { alert("Credit Card Number must contain 16 digits! Not " +strlen) CCok = false } return CCok } //--> </script> <FORM NAME="myForm" METHOD = POST ACTION = "http://64.224.111.216/cgi-bin/order.pl"> <td align=right><font face=arial><B>C. Card Number:</B></font></td> <td><INPUT SIZE=20 NAME="cnum" VALUE= "$cnum" onChange="checkCC(document.myForm)"> I chopped this out of my actual page for brevity, the usual <HTML> and all that is in there... Thanks for any insites!!! |
|
#2
|
|||
|
|||
|
It looks like your onChange value is set to lower case instead of upper:
is: onChange="checkCC(document.myForm)" should be: onChange="CheckCC(document.myForm)" Hope this helps! Yuccatan |
|
#3
|
|||
|
|||
|
yah that fixed it... =) Thanks, sometimes its hard to see those things... (grin)
-nate |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Please help me debug this form validation. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|