HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 24th, 2000, 11:28 AM
mistcat mistcat is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Washington, DC
Posts: 12 mistcat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!!!

Reply With Quote
  #2  
Old July 24th, 2000, 03:15 PM
yuccatan yuccatan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Boston, MA
Posts: 6 yuccatan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 8 sec
Reputation Power: 0
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

Reply With Quote
  #3  
Old July 24th, 2000, 03:43 PM
mistcat mistcat is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Location: Washington, DC
Posts: 12 mistcat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
yah that fixed it... =) Thanks, sometimes its hard to see those things... (grin)

-nate

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Please help me debug this form validation.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway