How to avoid email validation when using RSForm!Pro - RSMail! integration plugin
An issue you may encounter when using RSForm!Pro and RSMail! is that a user cannot submit your form twice using the same E-Mail, the form returning a validation error.
At the current moment, there is no built in feature that would allow this scenario to pass validation, however as a workaround you can insert the following script in the "Scripts called on form process" area (Form Properties > PHP Scripts).
Basically, what this script does, is grab the email's field's id (each form field is considered as a component) and checks if it has the proper format (something@something.com). If it passes the format validation, we force it to ignore other validation rules
// Grabs the ID of the form field $idc = RSFormProHelper::getComponentId("email_field_name"); // Check the value of the email field has the proper format $tmp = RSFormProValidations::email($_POST['form']['email_field_name']); // Remove the field's validation if it has proper format, // ignoring that the email is already registered if(in_array($idc, $invalid) && $tmp == '1'){ $pos = array_search($idc, $invalid); unset($invalid[$pos]); }
Note:
- Don't forget to insert the actual name of the Email field in the script provided
- Keep in mind that the Already Subscribed! error will still be shown, but your form will be submitted to the databse
You Should Also Read
Component Emails HOT |
PHP Email Scripts HOT |
Plugin - RSMail! (Create custom newsletter subscription forms) HOT |
Plugin - External Mailer (Use different email settings and add DKIM support) HOT |