Caspio allows many possible actions after end-users submit a form. In this article, we will guide you how to dynamically redirect a user to a specific URL based on their form input. It may be useful for:
- Multi-step forms where specific pages are filled out based on a user type.
- Registration that includes requests for more information.
- Targeted landing pages based on user information such as industry or location.
- Create and configure a Submission Form.
- On the Configure Fields screen, add a virtual field. This field is going to receive the user input and translate it into the user’s destination.
- Configure the properties of the virtual field to match the image below.
- Select Dropdown from the Form element dropdown. By default, the source of the dropdown will be custom values.
- In the Custom Values tab, enter possible choices. The display field will contain the option that is visible to your users. The value tab will contain the destination URL.
- Full URL: http://www.yoursite.com/pages/choice1.html
- Relative URL (both HTML pages are in the same directory): choice1.html
Note: In this example custom elements are used to define the possible destinations. You can also use a lookup table with one field for the dropdown display, and another field for the destination URL value. If you are not using relative URLs, be sure your URL includes the correct protocol (e.g. http://).
- Pass the virtual field as a parameter. Select the Advanced tab and enter the virtual parameter name in the On exit pass value to next page field.
- Configure the actions after the form is submitted. Select Go to a new page as the destination and enter or insert the parameter name in the Page URL. If you are using a relative URL, select Relative.
- Save the changes.
Note: In our example, we created a virtual field to receive input; however, if you have a lookup table for your destinations, you can also create a hidden cascading dropdown. Remember to ensure that this dropdown has no blank options, or is marked as required to avoid passing an empty destination parameter.