shortysbest Posted October 3, 2010 Share Posted October 3, 2010 I want to only allow birthdays to be entered like: 1/9/1992 or 11/19/1992 no other characters. and i want to only allow the first part to be a number be between 1 and 12, and then the second only between 1 and 31. could anyone help with any part of this? the first part is most important, but second part is nearly as important. Link to comment https://forums.phpfreaks.com/topic/215066-how-do-i-allow-only-numbers-and-and-also/ Share on other sites More sharing options...
.josh Posted October 3, 2010 Share Posted October 3, 2010 var someDate = "10/03/2010"; if (someDate.match(/^(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])\/(19|20)[0-9]{2}$/)) { // valid } else { // invalid } Link to comment https://forums.phpfreaks.com/topic/215066-how-do-i-allow-only-numbers-and-and-also/#findComment-1118710 Share on other sites More sharing options...
shortysbest Posted October 3, 2010 Author Share Posted October 3, 2010 PERFECT. Thanks a lot. A lot more simple than I thought. >.< Link to comment https://forums.phpfreaks.com/topic/215066-how-do-i-allow-only-numbers-and-and-also/#findComment-1118712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.