Multi-Question - the Question editor (Landbot 3 - only)
The multi-question block allows you to ask more than one question within a single message, making it easier for the customer to provide all the relevant information.
- On top of the block's configuration menu, you can set the Message: the main text that will show up on top of your multi-question message:
Here's how it looks:
- Now you can start adding questions as if they were buttons of a regular Buttons block. The name of the button will be the type of that specific question, selectable from the first dropdown, or the same as the field "label" in case this is set.
In this example, we're:
- Selecting Email as the question type.
- Setting "email" as the variable name where the answer will be saved in, without the @*
- Adding the label "Your email address" for this question's title.
We can click on the toggle 'Is required?' if we want the answer to be mandatory, meaning the user cannot skip it.
- If we scroll down a bit within this button's configuration and click on 'Extra options', we'll find a new set of configuration possibilities, namely:
- Placeholder. The text that shows up in the field itself. In the example below, "Enter your email".
- Help text. A little piece of text that gives context to the user. In the example below, "Put here your email address".
- Width. Here you can select if you want this question to fill the whole width of the form. In the example below, it's set to "full", but it can be 1/2, 1/3, etc.
And a few more for input validation:
- Input validation - Minimum characters.
- Input validation - Maximum characters.
- Input validation - Regex pattern. If you want to validate using a regular expression.
- Finally, this is what this example multi-question look like:
You can keep adding questions of different type to create amazing form-like messages, check the example below! 👇
Use case 1: Phone Validation with Regex
We are going to show how to validate a UK phone number format using Regex:
- Create a Multi-Question block and edit the question text
- Press Add New Question
- From the Question type section, select text
- In the "Save answer in" we are going to create if needed a variable type String called @phone_number
- Press "Extra options"
- Now in the bottom, we can see the input for our Regex Code:
- Let's search in Google for a Regex pattern. There are plenty of sites with examples for many cases, with a simple search like "uk phone number regex"
We find many results, one of the best pages to find already built Regex patterns is regextester.com:
- Once we enter we can see an already built example with few testing inputs:
In blue, are those tests that match with the Regex pattern above.
- Now we need simply to copy the Regex between the first / and the last /g:
- Paste this part in the Multi-Question regex pattern section:
- Press Save and text the bot
if the input from the user is doesn't match the Regex Pattern, it will alter the user, and ask to retry: