Created
February 9, 2010 09:50
-
-
Save jimmiw/299058 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Event.observe('submit_button','click', function(e) { | |
e.stop(); | |
var contact = $('form_name').getValue(); | |
var comment = $('form_comment').getValue(); | |
if(contact != '') { | |
var phoneRegExp = new RegExp('^[+]{0,1}[0-9]+$'); | |
var emailRegExp = new RegExp('^[a-zA-Z0-9._+-]+[@]{1}[a-zA-Z0-9._-]+[.]{1}[a-zA-Z0-9]+$'); | |
if(phoneRegExp.test(contact) || emailRegExp.test(contact)) { | |
$('contact_form').submit(); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment