How to check if two answers match, for example for email address verification

You can check if two given answers match, for example to be sure your respondent entered the right email address. You can achieve this with a combination of the right branch behavior, branch conditions and piping logic.

The concept

The most common usage of checking if two answers match, is when you want to be sure your respondent entered the right email address. You then have to enter your email address twice and you can only continue when those two match.

In Tripetto this is possible with a combination of the right branch behavior, branch conditions and piping logic. So let's see how to do that.

Checking for a mismatch instead of a match?

In this article we will describe how to check if two values match and if they do, continue with the form. You can also use this concept from a different angle by checking if two values mismatch and if they mismatch, raise an error so people cannot go further in the form.

See the last chapter of this article for an example of that.

Check for matching values

We will guide you through this setup step by step. This will show you how to match two email address blocks, but you can use this concept/setup also for other use cases of course.

Step 1 - Add two email address blocks

Add two email address questions.

First add two email address blocks to let your respondents enter their email address:

  • The first one to enter the email address;
  • The second one to confirm the entered email address;

Step 2 - Add a branch

Now let's add an empty branch for this cluster. In this case we know we'll be needing multiple branch conditions, so it's easier to start off with an empty branch.

Set right branch behavior

Because this branch will contain multiple branch conditions, it's important this branch has the right behavior set. In this case the behavior should be set to When all conditions match, by clicking the green bubble at the top of the branch and selecting the right behavior.

Add a branch with the right behavior.

Step 3 - Add branch conditions

To perform the check we'll be adding two branch conditions:

  • A check if the email address is specified;
  • The check if the two entered values match.

Add first condition

First we'd like to check if the first email address has been specified, because only if a value is specified we can check that value. To do so, click the button in the empty branchFrom the menu select your first email address blockSelect Email address is specified.

Add the first condition.

Add second condition

Now we can do the check if the two entered values match. To do so, we add another branch condition by clicking the button in the branchFrom the menu select your first email address blockSelect Email address match.

This will add the second condition to the branch. We can now click that condition to set the value to match. In our case that value is the second email address block. This is where the piping logic comes in. By typing the @ sign you can select your second email address block. Now this condition will check if the entered value of the first block matches the value the second block.

Add the second condition.

Step 4 - Add follow-up

You can now add the desired follow-up blocks underneath that branch. That way the follow-up blocks only will be shown if the respondent entered the same email address twice.

Check for mismatching values

In this example we showed how to check if two values match, but you can also turn it around by checking if two values not match and then for example raise an error so people can't continue when the values don't match.

To do this, go back to step 3 and instead of checking if the second condition matches, you check if this condition does not match.

And instead of adding the follow-up (step 4), you add a raise error block beneath the branch, so people can not continue.

Setup for a mismatch followed by a raise error block.

Use these helplines if you have any questions, problems or requests