In Cognito Forms, you can use if/then statements to enable a variety of both simple and complex scenarios on your forms. You can also combine these statements to set specific conditions based on your own custom criteria. For example, you can display multiple different messages depending on whether participants can attend your event or not.
To create a string of multiple if/then statements:
- Add a Choice field to your form (ex: ‘Will you be attending?’) with the options ‘Yes’, ‘No’, and ‘Maybe’.
- Add a Calculation field to your form. In the advanced editor, you can enter a series of if/then statements, separated by ‘else if’. Ex:
=(if WillYouBeAttending = "Yes" then "We can't wait to see you there!" else if WillYouBeAttending = "No" then "We wish you could come!" else if WillYouBeAttending = "Maybe" then "We hope you can make it!" else "")
- Save your changes. Now, a custom message will appear when a specific choice is selected.
Learn more in our Calculations guide.