SOLVED: Form redirect doesn't work when using a URL from a parameter

I have a Bricks form and I’m using the redirect feature with this tag:
{url_parameter:redirectto}
I have echoed this in a plain text box and it shows up correctly, the URL is there just as it should be.

The parameter is set on the page where the form exists, such as:

example.com/register/?redirectto=https%3A%2F%2Fexample.com%2Fsome-page%2F

To add the parameter, I’m running the URL through urlencode(get_permalink()).

I’ve also not encoded the URL so that it would look like this:

example.com/register/?redirectto=https://example.com/some-page/

I get the same result either way.
Basically, it just doesn’t redirect, nothing happens at all.
The redirect works fine if I insert a link manually or via other tags or plain text. But when I insert the URL using the {url_parameter}, nothing happens.

I tried adding the raw filter, not sure exactly how that works but I thought maybe something was goofing the URL.
{url_parameter:raw:redirectto}
or
{url_parameter:redirectto:raw} <<< this one just screws up the dynamic code output

It just doesn’t work for me, not sure what I’m missing!

1 Like

Hey Zack,

thanks for your report.

I was able to reproduce the issue and will see what we can do about it. :slight_smile:

For now please have a look at this example in the academy which is exactly your scenario and uses hidden field in combination with a custom form action.

Best,

André

Thanks. I found that section of the docs not long after posting the thread. It says explicitly the URL param isn’t sent because it’s over AJAX.

The docs say: “This is because the form was submitted in AJAX and the current page URL param will not be sent along the AJAX call.”

Ok, so wouldn’t the solution be to just go ahead and send the URL/params within Ajax instead of stripping it out? Seems kind of like an easy-button fix and would make form handling that much more useful when we need to use URL params.
Maybe sending that extra data adds a few extra bytes? Or maybe it slows down processing by 0.0002ms?
Whatever the reason, it’s surely much slower and heavier to have to create an extra field just to insert the param and then also enable custom actions and also build a PHP action to process it and read the field etc etc. That is surely the slower/heavier method.

Unless I’m missing some large technical issue, why can’t the ajax submission just keep the URL params intact and available through the dynamic snippet?
At the least, add logic like “if we use the url_parameter snippet, then be sure to pass through the URL params so it can be saturated with the data on the return.”

Anyway I’m sure you’ll figure it out!

Thanks!

I just ran into this as well. Would really like to be able to retain URL parameters on form redirect URL. I’ll see about using a custom function for now.

Hi guys,

We’ve fixed this issue in Bricks 1.11 BETA, now available as a manual download (Bricks – Account)

Please let us know if you are still experiencing issues.

You can see the full changelog here: Bricks 1.11 Changelog – Bricks

As with any beta release, please do not use it on a production/live website. It is only meant for testing in a local or staging environment.

Best regards,
Matej

1 Like