• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Validate with another forms submissions?

Validate with another forms submissions? 11 years 5 months ago #25826

Hi All

I have 4 forms, all the same apart from a certain field thats the specific. I want to validate the email address field, so that it queries the other 3 forms submissions, and if the email is in one of those form submissions, stops the user from progressing.

Any ideas if possible?
The administrator has disabled public write access.

Validate with another forms submissions? 11 years 4 months ago #25897

Ok, this kinda works if I add it to validation.php:

}

public static function unique($value, $extra = null, $data = null) {
// The following will check if the current value is indeed an email
if (!self::email($value, $extra, $data)) {
return false;
}

// Get the current form ID.
$formId = JRequest::getInt('formId');

// Gets the current field's name.
$name = $data;

// Get a database connection.
$db = JFactory::getDbo();

// Setup the query. AND `FormId`='".$formId."'");
// This query checks the #__rsform_submission_values table if the current field
// has already had this value submitted (ie. if the value isn't unique).
$db->setQuery("SELECT * FROM #__rsform_submission_values
WHERE `FieldName`='".$db->escape($name)."'
AND `FieldValue`='".$db->escape($value)."'
AND `FormId`='4'
OR `FormId`='9'");
if ($db->loadResult()) {
// A value has been found in the database, the validation failed.
return false;
} else {
// A value has not been found.
return true;
}

---

My only issue is that it has to wait till they press submit before it tells them its already been entered. Anyone know if there is a away to get it to manually check as soon as the next field is entered?
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!