How do I redirect after submitting a form?
Learn how to automatically redirect users to a thank-you or confirmation page after submitting a form in Blutui.
Introduction
When a user submits a form, you may want to redirect them to a thank-you page, confirmation screen, or any other route in your project.
Blutui makes this easy — simply add a hidden redirect field inside your form.
This guide will show you how to set up a form redirect in just a few lines.
Wrap your form with the form tags
First, ensure your form is created using the Canvas form tag:
{% form 'contact' %}
{# Form elements go here #}
{% endform %}Replace contact with the handle of the form you created in the dashboard.
If you need help creating a form, view the How do I make a form in a Blutui project? guide.
Add the redirect field
Inside your {% form %} block, add a hidden input named redirect:
{% form 'contact' %}
<input type="hidden" name="redirect" value="/contact/thank-you">
{% endform %}The value is the page you want the user to be taken to after the form is submitted.
In this example:
/contact/thank-youThis means the user will be redirected to the thank-you page once the form is processed.
Make sure the redirect page exists
The redirect will only work if the target page exists.
If you need help creating a page, follow the How do I create a page? guide.
Example structure
Here is a full example of a contact form with a redirect and form fields using the form macro:
{% form 'contact' %}
<input type="hidden" name="redirect" value="/contact/thank-you">
{% for field in form.fields %}
{{ ui.field(field) }}
{% endfor %}
<button type="submit">Send</button>
{% endform %}Next steps
You now have a fully working redirect after form submission. This is useful for:
- Contact forms
- Booking forms
- Application forms
- Confirmation screens
Last updated on