Using logic4 Min.

How to update values throughout your form

You can dynamically update block values throughout your form to different values, for example based on given answers of your respondent.

When to use

You can simply prefill certain values in your form, but there are also situations where it can be handy to update certain values while the respondent is filling out the form. Some examples:

  • Based on a given answer to a multiple choice question you can already check some checkboxes later in the form;
  • You have two separate email address blocks in your order form: one for the 'Confirmation recipient' and one for the 'Invoice recipient'. Your respondent first fills out the confirmation recipient. Now you can use that entered email address as the value for the invoice recipient;
  • You want to compose an advice based on given answers of your respondent and you want to show that advice at the end of the form.
Screenshot of prefilled values in Tripetto
Demonstration of taking over the value from another question block.

📌 Also see: Prefill values

Are you just looking to prefill blocks with an initial value? Please have a look at this article: How to prefill question blocks with initial values.

How to use

In the article you're reading now we describe how to update values throughout your form. We use the set value block for that. For global instructions about the set value block, please have a look at this article.

Add set value block

First build your form with the question blocks you want to update the value of.

Continue with adding a set value block. Please be aware that the position where you place the set value block in your form can influence how it will behave. Two examples to demonstrate:

  • If you place a set value block at the beginning of your form, it will immediately set the values that you define;
  • But if you place a set value block for example inside a branch, then the defined values/actions will only be executed if the respondent enters that branch.

Select purpose

Now open the set value block. You will first see the Purpose feature. Set that to Advanced. Now the set value block gives you way more freedom to do all kinds of data actions. You will see those possibilities in the next step.

Screenshot of the form builder in Tripetto
A form setup with an empty set value block with purpose Advanced.

Add values

Now you can make a list of question blocks that you want to update. Per row you can now configure exactly how the value setting should behave:

  • Values - Configure what value you want to enter, for example a fixed value, query string value or from another variable;
  • Mode - Configure what needs to be done with the current value of a block, for example overwrite it, concatenate it (text values) or perform calculations (number values);
  • Locking - Configure if the block should be locked for changes by the respondent.

Example: take over block/variable value

In this example we want to take over the entered value of two email address fields. Let's say the value from the 'Confirmation recipient' question should be copied into the 'Invoice recipient' question. Follow these steps:

  1. Start with adding the two email address blocks for 'Confirmation recipient' and 'Invoice recipient';
  2. Add a set value block at the end af the form (to take over other variables, the set value block has to be entered after the block that you want to take the value from);
  3. In the new set value block, set the Purpose to Advanced;
  4. Then click the button at the bottom of the Values list to add the desired value actions;
  5. Next select the Invoice recipient question from the form;
  6. Now select From other variable as the desired value;
  7. Now select the question block you want to get the value from. In this case that is our Confirmation recipient question;
  8. Make sure the Mode is set to Overwrite, so the value will be overwritten at each value change.

That's it! Now the form will constantly update the value of the 'Invoice recipient' with the entered value in 'Confirmation recipient'.

Screenshot of the form builder in Tripetto
The steps to take to overwrite the value with a value from another question block/variable in your form.

Example: compose an advice

In this example we want to compose a list of suggestions, based on selected options by the respondent. Each selected option adds a row to our advice list. At the end we show the full advice as a text. Follow these steps:

  1. Start with building your form. In our example we show checkboxes that respondents can select. For each checkbox the respondent selects, we want to add a suggestion to our advice;
  2. Add a custom variable block and set the Type of that to Text. Give it a name, for example Advice. We will use this custom variable to compose the advice text;
  3. Create a logic branch for each checkbox from our checkboxes question;
  4. Add a set value block inside each branch. We will use those to add the right suggestion for each selected checkbox;
  5. In each set value block, set the Purpose to Advanced;
  6. Then click the button at the bottom of the Values list;
  7. Next select your custom variable block called Advice;
  8. Now first set the Mode to Concatenate; with this mode the value of the custom variable will be appended with the advice we will give for this branch. This way we can compose a list of items;
  9. Now select Fixed value as the desired value;
  10. You can now enter the advice. And you can select how this must be added to the text value. In this case we want it to start on a New line.
  11. Repeat this for each branch;
  12. Now the custom variable Advice will have the full advice. And you can show that to your respondent.

That's it! Now the form will show the whole advice that's saved in the custom variable.

Screenshot of the form builder in Tripetto
The steps to take to concatenate a text value in a custom variable.
Screenshot of the form builder in Tripetto
The end result to compose an advice and show that to the respondent.

More information

The set value block has lots of possibilities, so we have several help articles to learn all about it:

In this article

    Help us improve