It might help you to debug if you were to label each of the error messages
differently so that you know which one is being triggered. Another thing you
might want to check is the order of operations on your comparisons for
Mastercard and American Express. I think that by adding a few parens around
the statements would make it clearer. For instance x && y || z should be x
&& ( y || z ). Or at least that's what I think you're trying to validate
against.

?

Nate



> -----Original Message-----
> From: Douglas L. Brown [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 1:49 PM
> To: CF-Talk
> Subject: Re: OT Quick JS ?
> 
> 
> Well here is what I did. As per Nate's suggestion I put the 
> !== to a != and
> still it alerts that the value is not correct. As per Dave 
> suggestion I took
> off the () after the return false and it submit the page and 
> does a write of
> the word false
> 
> 
> 
> Im frustrated, this should be easy, but is proving diffucult
> 
> 
> Here is the updated code
>  var type = target.card_type[target.card_type.selectedIndex].value;
>  var number = target.card_number.value;
>  var first_number = number.substring(0,1);
>  var first_two_numbers = number.substring(0,2);
>  var first_four_numbers = number.substring(0,4);
>  if ( type == 'VISA' && parseInt(first_number) != 4){
>  alert("Invalid Card Number");
>  return false;
>  }
>  if ( type == 'MAST' && 1* parseInt(first_two_numbers) < 50 &&
> parseInt(first_two_numbers) > 56 ){
>  alert("Invalid Card Number");
>  return false;
>  }
>  if (type == 'AMEX' && 1* parseInt(first_two_numbers) != 34 ||
> parseInt(first_two_numbers) != 37){
>  alert("Invalid Card Number");
>  return false;
>  }
>  if(type == 'DISC' && parseInt(first_four_numbers) != 6011){
>  alert("Invalid Card Number");
>  return false;
>  }
> 
> 
> 
> Doug


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to