-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Labels
Milestone
Description
Can just use HTML 5 input attribute pattern type thing instead of regex
Note that this should really just modify this section of app/assets/javascripts/validate.js
hackathon-manager/app/assets/javascripts/validate.js
Lines 34 to 51 in 5f4a844
| case 'email': | |
| if (value) { | |
| var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
| if (!re.test(value)) { | |
| notify(this, 'Invalid Email'); | |
| success = false; | |
| } | |
| } | |
| break; | |
| case 'phone': | |
| if (value) { | |
| var phoneReg = /^[\+]?[0-9]{0,3}[-\s\.]?[(]?[0-9]{1,3}[)]?[-\s\.]?[0-9]{1,3}[-\s\.]?[0-9]{4,6}$/; | |
| if (!phoneReg.test(value)) { | |
| notify(this, 'Please enter a valid phone number'); | |
| success = false; | |
| } | |
| } | |
| break; |