How to compare given answers
Learn how you can compare two given answers from a respondent inside your form, for example for email address verification.
When to use
In Tripetto you can compare every given answer with another given answer. Based on the outcome of the comparison, you can then take the right action, for example continue if the given answers mathc, or show an error if the comparison does not match.
The most common usage of comparing two given answers, is when you want to be sure your respondent entered the right email address. You can then let your respondent enter their email address twice and compare those inputs, so no typing mistakes have been made.
📌 Also see: More logic possibilities
The logic described in this article is an example of what Tripetto can do to make your forms smart. Discover the power of branches for your logic to see all logic capabilities.
How to use
In Tripetto you can do this quite easily with branch logic. Depending on the question type, you have several options to check a branch condition. In general you can choose between:
Fixed value- A fixed value that you enter in the form builder;
Answered value- A flexible value that your respondent has answered in another question in your form.
The second option is what we need to compare two given answers of a respondent. Let's say we want to compare two entered email address questions, so we know for sure the right email address is entered. If they don't match, we want to show an error.
To demonstrate this we already added two email address blocks to our form.
Now we can simply add a branch and add a condition for the second email address block. In this case we add a branch condition for
Email address mismatch.
In the properties of that branch condition we can now determine what value we want to compare. To do so, we select
Value. Then a list will be shown of all other question blocks in your form that you can compare the value with. In our case, we select the first email address block from that list.
The form now checks if the entered values of those question blocks are mismatched, so we can react to that comparison.
Now we can setup the follow-up for this branch. In this case we add a raise error block to prevent our respondents to proceed without a correct entered email address.
The form will now show an error message, preventing the form to continue, whilst the respondent has not entered the exact same email address in the two email address blocks.