You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the following code to reload a page with the ID of a newly created "lead" entry from an entry form:
redirectInput(url(baseUrl, 'lead_id={id}')
It was working originally, but after upgrading to Craft 4.5, the params argument is no longer replacing {id} with the entry ID when the form gets submitted. Instead of ?lead_id={id}, the generated URL includes ?lead_id=%7Bid%7D.
It works if I only use the path argument: redirectInput(url("#{baseUrl}?lead_id={id}")) or if I use regular Twig template interpolation: redirectInput(url(baseUrl, "lead_id=#{formId}")).
However, those options don't work for me, because my baseUrl variable has an anchor in it. If I use the params argument, the anchor gets bumped to the end and everything works, but if I only use the path argument, the params get ignored because they come after the anchor. I can split up my anchor to a separate variable and concatenate everything, but I think this is a bug.
Side note: I don't know what that type of system-generated variable is actually called: {id}. Is it a token?
Steps to reproduce
Create an entry form.
For the redirect URL, use the URL function. Include {id} somewhere in the params argument.
Load the page and inspect the generated redirect URL.
Expected behavior
We should see {id} in the URL params for the redirect URL. Submitting the form should replace {id} with the actual ID of the newly created entry in the new URL.
Actual behavior
The redirect URL params include ?%7Bid%7D, even after submitting the form.
Craft CMS version
Craft Pro 4.5.1
PHP version
8.2.7
Operating system and version
Darwin 22.5.0
Database type and version
MySQL 8.0.33
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered:
What happened?
Description
I'm using the following code to reload a page with the ID of a newly created "lead" entry from an entry form:
It was working originally, but after upgrading to Craft 4.5, the params argument is no longer replacing
{id}
with the entry ID when the form gets submitted. Instead of?lead_id={id}
, the generated URL includes?lead_id=%7Bid%7D
.It works if I only use the
path
argument:redirectInput(url("#{baseUrl}?lead_id={id}"))
or if I use regular Twig template interpolation:redirectInput(url(baseUrl, "lead_id=#{formId}"))
.However, those options don't work for me, because my
baseUrl
variable has an anchor in it. If I use the params argument, the anchor gets bumped to the end and everything works, but if I only use the path argument, the params get ignored because they come after the anchor. I can split up my anchor to a separate variable and concatenate everything, but I think this is a bug.Side note: I don't know what that type of system-generated variable is actually called:
{id}
. Is it a token?Steps to reproduce
{id}
somewhere in theparams
argument.Expected behavior
We should see
{id}
in the URL params for the redirect URL. Submitting the form should replace{id}
with the actual ID of the newly created entry in the new URL.Actual behavior
The redirect URL params include
?%7Bid%7D
, even after submitting the form.Craft CMS version
Craft Pro 4.5.1
PHP version
8.2.7
Operating system and version
Darwin 22.5.0
Database type and version
MySQL 8.0.33
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: