Field Validation of previous entry

Hey GravityForms-Geeks :slight_smile:

we have several fields and save via User-Registration every field in the user_meta, so we can display them again.

Now we have field XY and want in just one of the forms, that if the new entry is the same as before it should bring an Error.

User A is filling the form 1 for the first time in the field “XY” he puts “1234”.
When he now want to fill form 2 and puts in the field “XY” the entry “1234” - now an error should appear. When he would enter “5678” everything is fine.

The fields in both forms are mapped with user_meta via “User Registration”.

Any idea how to apply it?

Thanks for your adive!

Hi Erik. I think the simplest way to accomplish this with Gravity Forms is to use the Gravity Wiz Limit Submissions Perk:

You can configure that plugin with a feed that limits a user to one submission per user per value in a given field. The entries would keep the history of submitted values by that user. The setup would look like this:

If you have any other questions, please let us know or contact Gravity Wiz for additional details.

1 Like

Thanks for your idea, but limit submission is working before entering the form. But it should just be if the entered value is the same as before. So he should be allowed to enter the form and do his entries, but just if the one field is the same as before. It should bring an error.

add_filter( 'gform_field_validation_40_2', 'custom_validation', 10, 4 );

function custom_validation( $result, $value, $form, $field ) {

	if ( ! empty( $value ) && ! preg_match('/^[a-zA-Z0-9äöüÄÖÜ._]+$/', $value ) ) {
		$result['is_valid'] = false;
		$result['message'] = 'Leider ist dies keine gültige Eingabe. Bitte verwende kein @, # oder Links.';
	return $result;

Isn’t it possible to do it with the field_validation? So we don’t use a preg_match, and instead something like

if entry = usermetaXY - > then error message.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.