I have used RS form form for user Registration on my joomla site. There i want to make registration from only company email address for internal users. How can i do this ? Please advice. Is there any way of configure custom email domain for RS Form email validation field?
Asked
Active
Viewed 1,186 times
2 Answers
0
You can use a Regular Expression as field validation (instead of email).
- While on the RS Form, edit the field and go to Validations.
- Change the Validation Rule to Regex.
- Set the Regex Syntax to
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@yourdomain.com$/
Note: be sure to change "yourdomain.com" to your own domain.
Validating emails using regular expressions is not perfect. See Using a regular expression to validate an email address. The first part of the regex I suggested here is taken from w3.

Community
- 1
- 1
Matteus Hemström
- 3,796
- 2
- 26
- 34
0
If you need a workaround and hardcode it, you can try the following approach in code:
// Domain to check
$email_domain = "@mydomain.com";
// Email to check
$co_email = "joefoobar@mydomain.com"; // returns true => valid
//$co_email = "joefoobar@gmail.com"; // returns false => invalid (uncomment to test)
if(!substr_count($co_email, $email_domain) > 0){
// Set the error
echo "Invalid!";
} else {
// No error, proceed with code
echo "Valid!";
}
McRui
- 1,879
- 3
- 20
- 31