Validating credit card Free xxx porn cams no sing up

by  |  18-Jan-2016 14:46

It's still amazing to me that so many sites have no idea how to make a simple form usable.

This article presents methods for validating credit card numbers in a user-friendly fashion.

A lot of forms set the of the field to 16 characters which means that you can type most of your number - using spaces or dashes to separate blocks of numbers - before running out of space and having to go back and remove the spaces before entering the rest. Others will let you enter the number with extra characters, but then send you back an error message when the form is submitted. Let's see how we can do it better: What have we done then?

: When the form is submitted the credit card input will be numbers only which is handy for processing, but you shouldn't force the user to do the work for you.

Remember it is always necessary to validate form input values using a server-side script to cater for non-Java Script browsers or exploit attempts.

This example goes one step futher and also checks that the number entered is valid according to the Luhn algorithm (also known as the "mod 10" algorithm).

This requires an extra Java Script function that implements the Luhn algorithm: For the logic and history behind the algorithm see the link above.

Community Discussion