And while the back-end validation is of course vital, if you want to do it on the front-end as well (in Javascript), note that it's a built-in feature of CFINPUT, validate="creditcard".
Yes, yes, I know that purists would never use CFFORM, and I know that you can't rely on client-side validation for security because it can be circumvented and won't work if JS is disabled on the browser, yadda, yadda. That's why I note that this would be subsidiary to server-side validation. Still, it's a lot more user-friendly to catch it on the front-end first, if you can. All that said, I suppose some will still have more to say. Shields up. Engage. :-) /charlie From: [email protected] [mailto:[email protected]] On Behalf Of Shawn Gorrell Sent: Wednesday, March 10, 2010 12:26 PM To: [email protected] Subject: Re: [ACFUG Discuss] validating credit card numbers with CF Pretty much. Sent from my iPhone On Mar 10, 2010, at 11:22 AM, Dusty Hale <[email protected]> wrote: Thanks shawn. Would that be as simple as doing this: <cfif not refind("^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$" ,trim(form.card_number),1)> <!--- do something ---> </cfif> On Wed, Mar 10, 2010 at 11:12 AM, shawn gorrell <[email protected]> wrote: ^((4\d{3})|(5[1-5]\d{2})|(6011))-?\d{4}-?\d{4}-?\d{4}|3[4,7]\d{13}$ _____ From: Dusty Hale <[email protected]> To: [email protected] Sent: Wed, March 10, 2010 11:05:47 AM Subject: [ACFUG Discuss] validating credit card numbers with CF Does anyone have a CF code snippet for validating credit cards numbers? Dusty ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink <http://www.fusionlink.com> ------------------------------------------------------------- -- Dusty Hale Email: [email protected] Phone (Atlanta): 404.474.3754 Phone (Toll Free USA): 877.841.3370 Website: www.DustyHale.com ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by FusionLink <http://www.fusionlink.com> ------------------------------------------------------------- ------------------------------------------------------------- To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
