Jump to content
Larry Ullman's Book Forums
kreut

Not Allowing Dashes And Spaces?

Recommended Posts

Hi,

 

I just finished  reading through Larry's excellent stripe.com tutorial.  Though it works great, I did have one question.  In his code, he doesn't allow spaces or dashes in the credit card number.  Might it be more user friendly to strip out the spaces/dashes after the user submits the form in his submit function?

 

 

var ccNum = ccNum.replace(/-/g,"");
var ccNum = ccNum.replace(/ /g,"");
 
Or are there any pitfalls to this approach?
 
Thank you,
 
Eric

Share this post


Link to post
Share on other sites

Thanks for the nice words. I appreciate it. I should clear up my example, however. Although the form says not to use spaces or hyphens, there's nothing in the code preventing them from being used and the Stripe.js library wisely allows for them, too. Your additional code will work, but it's not actually necessary. Sorry for the confusion!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...