×Overview

Conditions and Logic

Variables can also be used to modify a flow's behavior once they are collected. This is useful for making flows dynamic and more personalized to a specific user's needs.

Conditional steps and questions

Steps and questions can be made conditional, wherein they only appear if a certain logical constraint holds true.

Currently, the following logical operators are supported:

Equals
The answer exactly equals the value.
Does not equal
The referenced answer does NOT equal the value.
Greater than
The referenced answer is greater than but not equal to the value. Only available for number-type answers.
Less than
The referenced answer is less than but not equal to the value. Only available for number-type answers.
Matches regular expression
The referenced answer matches the regular expression pattern.
Does not match regular expression
The referenced answer does not match the regular expression pattern.
Is defined
The referenced answer has any value set, even false. This is particularly useful for hiding parts of a step that you don't want to show unless an answer is provided.
Is not defined
The referenced answer has not been set.
Was defined on load
The referenced answer was set in the URL, a POST, or otherwise present when the form was first loaded. Useful for skipping questions you do not want users to confirm.
Had a loading error
The referenced answer is calculated dynamically or loaded from an API, and there was a problem when determining its value.

Advanced logic

If advanced logic is set, you may enter logic using the MongoDB Query and Projection operators. For example, if you were checking whether a user is over 18 years of age and lives in the USA or Canada, you could add the following as a condition:

{
  $and: [
    {
      $age: { $gte: 18}
    },
    {
      $country: { $in: ["USA", "Canada"]}
    },
  ]
}

See Passing data in for more advanced ways to enable arbitrarily complex logic for conditions, where you can calculate the logic on your own server.

Terminal steps

Steps can also be made terminal, meaning that they end the flow if they are reached. Together with setting a condition, you can use terminal steps to route users based on their previous answers, or disqualify users from continuing if they do not meet certain criteria.

Redirect URLs

You may set a redirect url, which can use variables defined up until that point in the flow, which terminated users will be redirected to. These redirect URLs may be templated using variables you've collected.

For example, if you collect a variable that you've given the name first_name, you could pass this variable to the redirect landing page by setting the redirect URL to https://example.com?first_name={{first_name}}.

Validation

Your flow is constantly checked for validation errors which would result in logical inconsistencies. If you are unable to publish, you will see a list of logical problems that you need to resolve before the flow can safely be shown to users in a way that it can be completed without jumpiness or inconsistency.

Previous
« Variables and schemas

Contact
  • hello@formsort.com
  • Jobs
  • Security
Resources
  • Formsort Inc
    © 2020