FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I've been using FormTools + RSV for a couple year now, and someone just stumped me...
#1
I have been asked if it is possible for me to validate an e-mail address field so that it is required to be of the form:

[SOMETHING]@owu.edu

Up until now, it has been sufficient for me to use a valid_email requirement to ensure that the field is of the form:

[SOMETHING]@SOMETHING.SOMETHING

My question is...how would I go about checking for the former instead of the latter?

I'm sure it's relatively simple...I just don't know enough about RegEx or programming in general to make it work.

Thanks in advance for any help you can provide,

Doug Thompson
Manager of Web and Electronic Communications
Ohio Wesleyan University
Reply
#2
Hi Doug,

Thanks for the post!

You hit the nail on the head: regular expressions are the way to go. Try this:

Code:
rules.push("regexp,email_field_name,.*@owu\.edu$,Please enter a valid OWU email address.");

I confess I haven't tested it out, but that should work okay... knock on wood. You'll need to change the "email_field_name" to the name of your email field, and enter in whatever error message you want. Let me know if you have any trouble!

- Ben
Reply
#3
That works perfectly!

Thanks,

Doug
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)