Guides & tutorials

Getting started with forms with conditional logic

No items found.
Download this tutorial scenario and import it in your workspace
Table of contents

Conditional logic is a great way to create forms that automatically change based on different inputs, whether they are user responses or any check made on the backend.

In this guide, we collect different ways to use conditional logic in forms, so you can get the most out of it and build adaptive forms exactly tailored to your needs.

How to add conditional logic to a form

To use conditional logic in your Arengu form simply add an 'If then condition' action to the flow connected to it. Just click on the plus button and select it from the actions menu.

When you add this action to the flow, it will create two branches to trigger different actions depending on whether or not the condition you set in it is met.

To set the condition, reference the variable you want to check on in the first input. You can get it from the autocomplete menu, on the plus button, after an execution of the flow.

Then select the condition that best suits the needs of your form. If needed, add more conditions simply by clicking on the 'AND' button.

When to use conditional logic in forms

‘If/then condition’ actions allow you to manage the previous action responses, and to set custom checks and conditions based on form inputs. These are some of the most common use cases, which you can also easily build with the editor.

1. Signup forms

When building registration forms, you will need to use conditional logic after checking if the email or phone number is already registered. For example, add the ‘If/then condition’ after a 'Look up' action to check if there is already a user created with that email or phone.

Then we can trigger different actions based on this check: display an error message in the form if the email or phone number is already registered, or create the account.

2. Login forms

When building login forms, we will use it in a very similar way, after the login action, to check if it was successful. This way, we will create two branches with different behaviors: one to display the proper error message in the form — if the email or phone number is not registered, or if the credentials are not valid — and another one to log the user in.

3. Risk-based and MFA forms

In addition to checking if the user is registered and their credentials are valid, you can use conditional logic to create adaptive multi-factor authentication forms.

For example, you can connect the form with an IP risk scoring service and ask for different authentication factors based on the risk score, to create a use case like this.

For example, we can add a conditional action to determine if the IP scoring is safe or not.

In this case, we have set 40 as the limit scoring for a secure IP. This action will check it and trigger two different actions, based on whether the result is higher or lower than 40.

If the scoring is too high for our set standard, a OTP will be generated and sent to the user’s email. If not, the user will be logged in.

4. Lead qualification forms

You can also use conditional logic to build smart forms and frictionless lead generation forms. For example, adaptive multi-step forms whose questions change based on the user's responses or depending on the data provided by a data enrichment service. 

The 'If/then condition' actions will allow you to create each of the form branches and decide what questions to display or what actions to trigger in each one of them.

For example, you can make the form offer (or not) the user the possibility of closing a meeting with a salesperson, based on the qualification.

5. To trigger different after-submission actions

The use of conditional logic is not only used between form steps, but also to trigger actions after the submission of the form such as personalized notifications, a welcome email, sending user data to a CRM, etc.

Not knowing how to start? Using conditional logic in your forms is as easy as registering in Arengu. Start a form from scratch or use one of the fully editable templates to make it even easier and faster. Sign up free or schedule a demo with our team!

You might like to read

See more tutorials

Getting started with Arengu

Arengu allows you to build all your user flows connected to your current stack, and avoids coding all the UI, complex integrations, validations or logic from scratch. Try it for free and start building faster and scaling your application needs as they grow.