Check for Existing Emails in Database Before Submitting RSForm

Looking to add a line break in the placeholder text area of the RSform, but so far, no success. A form sample with the non-working text area can be found on the last page of the freelancer-form.
One solution is to explore the js and non-js options offered in this StackOverflow thread: It is important to note that the non-js technique may have different outcomes on different browsers. For complete documentation on the jQuery Masked Input, visit
If you prefer not to edit your index.php file, you can add the code to each form that requires Masked by navigating through Components >> RSForm >> Edit your form >> Tab Properties >> Tab Script and pasting the JavaScript code into the field without “—“.


My RSForm comprises of the subsequent fields:

  • Full Name
  • Email Address

Is it possible to utilize the


script to verify whether or not the email address provided already exists in the database, as my intention is solely to gather new data?

As per the documentation of RSForms, it’s possible to achieve this task.


I am uncertain about which coding language to utilize.


To input the required information, go to the second textbox located in the
form properties
section and select the ”
PHP Scripts
” option.

$formId = 0; // CHANGE THIS VALUE to your form ID
$db = JFactory::getDbo();
$query = $db->getQuery();
    ->where("FormId = " . $db->q($formId))
    ->where("FieldValue = " . $db->q($_POST['form']['email_address'] ));
$num_rows = $db->getNumRows();
// We found this email in the submissions
if ($num_rows > 0) {
    $invalid[] = RSresolveComponentName('email_address', $formId);
    echo RSshowForm($formId, $_POST['form'], $invalid);

To establish a new validation rule for the email_address field, you can include the function in the file validation.php located in components/com_rsform/controller/. Afterwards, you can choose “unique” as the Validation Rule by modifying the email_address field.

function unique($param, $extra=null)
    $db = JFactory::getDBO();
    $param = $db->getEscaped($param);
    $db->setQuery("SELECT * FROM #__rsform_submission_values WHERE `FieldName`='email_address' AND `FieldValue`='".$param."'");
    $invalid = $db->getNumRows();
    if ($invalid)
        return false;
    return true;

Additional information regarding custom validations can be found on this webpage:

Refer to this helpful thread at the RSJoomla forum, which discusses setting up a form that restricts each user to only one submission:

Frequently Asked Questions

Posted in Php