Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend entry form - name of variable containing submission data #6240

Closed
piotrpog opened this issue Jun 19, 2020 · 2 comments
Closed

Frontend entry form - name of variable containing submission data #6240

piotrpog opened this issue Jun 19, 2020 · 2 comments

Comments

@piotrpog
Copy link

@piotrpog piotrpog commented Jun 19, 2020

When we submit frontend entry form with errors, variable is injected in template that contains our submission data and errors information.

Problem is, this variable is called entry, which conflicts with the existing entry variable (the page that contains entry form might have has its own entry).

I know that changing variable name would be breaking change, so why now allow changing its name using config setting?

@timkelty
Copy link
Contributor

@timkelty timkelty commented Jul 7, 2020

@piotrpog I swear I made this FR a couple years ago, but now can't find it…so I'm glad you posted!

@brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Jul 17, 2020

As of Craft 3.5 it will be possible to specify the variable names that the asset/category/entry/user should be passed back to the template as if they contain validation errors, like so:

{# asset forms #}
{{ hiddenInput('assetVariable', 'badAsset'|hash) }}

{# category forms #}
{{ hiddenInput('categoryVariable', 'badCategory'|hash) }}

{# entry forms #}
{{ hiddenInput('entryVariable', 'badEntry'|hash) }}

{# user forms #}
{{ hiddenInput('userVariable', 'badUser'|hash) }}

Thanks to @timkelty for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.