Skip to content

Instantly share code, notes, and snippets.

@bluepnume
Created June 8, 2017 16:23
Show Gist options
  • Save bluepnume/fb4bf3b992e0d6d23eeecd4693690032 to your computer and use it in GitHub Desktop.
Save bluepnume/fb4bf3b992e0d6d23eeecd4693690032 to your computer and use it in GitHub Desktop.
// Create a form with:
// * A text field for a credit card number
// * A button to submit the credit card
//
// Requirements:
//
// - The page should do some client side validation, and only allow credit card numbers which are:
// * 16 digits long
// * Only contain numbers, spaces, or dashes
//
// - If the validation fails, the page should show an error message next to the form field
// - If the validation succeeds, the page should make an ajax call to /api/credit-card/validate with the number to do server-side validation
// - The page should then show a success message, or a validation error
//
// Bonus:
//
// - Make the client/server validation happen as the user types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment