Celebrate WordCamp Asia 2024 with 30% OFF! Use coupon WC30 - Terms

Redirect

The Redirect action redirects the website visitor’s browser to a chosen website address when they save or submit a form.

Adding a Redirect Action

To add a Redirect action:

  1. When editing your form, click the Actions icon at the top of the page. The Actions sidebar will open on the side of the page.
  2. Click the Add  icon to add a new action.
  3. Select Redirect from the Action pulldown. A series of settings will appear.

As with all sidebars in WS Form, click to the Save button at the bottom to save your changes, or click Cancel to disregard your changes.

The available options are as follows:

When Should This Action Run?

You can redirect the website visitor when the form is saved, submitted, or both.

Type

There are three different types of redirect you can perform:

  • URL
  • Page
  • Post ID

URL

Enter the URL you where you would like to redirect the website visitor to. This can be an absolute or relative URL.

For example:

  • Absolute: https://wsform.com/knowledgebase/
  • Relative: /knowledgebase/

WS Form variables can be used in this setting.

Page

Search for the page you want to redirect to.

Post ID

Enter the Post ID you wish to redirect to.

WS Form variables can be used in this setting.

Query String Parameters

We recommend using this setting if you need to add query string parameters to your URL. WS Form will URL encode your query string parameter values automatically by using this feature. WS Form variables can be used in the field and value settings.

To add a query string parameter:

  1. Click the Add  icon.
  2. Enter a Field and Value for the query string parameter
  3. Repeat as necessary for each parameter

WS Form variables can be used in the Field and Value settings.

An example configuration is show below:

WS Form PRO - Redirect Action - Adding Query String Parameters

Dynamic Redirect

It is possible to set the URL setting dynamically using a query variable. To do this:

  1. Drag a Hidden field to your form (We suggest adding it under the Submit button).
  2. In the Default Value setting, enter: #query_var("r").
  3. Make a note of the Field ID shown in the top right, for example, #123.
  4. Click Save at the bottom.
  5. Click the Actions icon at the top of the page. The Actions sidebar will open on the right hand side of the page.
  6. Click the Add  icon to add a new action.
  7. Select Redirect to a Page from the Action pulldown. A series of settings will appear.
  8. In the URL setting, enter: #field(123) where 123 is the Field ID of the hidden field you added. You can also click the variables icon to the right of the URL setting to find the field variable.
  9. Click Save at the bottom.

The login will now redirect to whatever the r query string parameter is set to.

An example login URL would therefore be:

https://wsform.com/log-in/?r=%2Fwelcome%2F

This URL would redirect to /welcome/ after a successful login.