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
{{ message }}
Repository navigation
User registration form with custom redirects has no error or success values in the response #3669
User registration form with custom redirects has no error or success values in the response. Needed to add a query param and now don't have access to the success or error values.
This worked fine some Statamic versions ago. Right now on 3.1.14, I don't get any success or error messages. When I have a form with some server side validations, those error messages also do not appear anymore. I tested this part of my code very intensively and there was nothing changed except updating Statamic with its dependencies.
Soo, I tested the issue and I have some observations:
When I do a form submit, I get a 302 redirect. I checked my .htaccess, but every redirect there has a 301. If this redirect is not normal, then this should be the issue. Because when redirecting with 301/302, we lose the response data.
The URL is /!/forms/contact, where contact in my form handle.
But I am too stupid to fix this, because I have no clue where to look...
Well, the 302 redirect is the normal redirect by back(). I get my error messages inside formFailure() inside FormController.php. So I assume the issue is after this code, maybe there is some new middleware logic that strips data?
Is there anyone watching this issue? I find this bug to be important, because it really makes forms completely useless and very bad for customers (because of no feedback like success or errors)...
@jasonvarga Could you help with that? I did more debugging than I wanted, but I have no idea how things are internally connected to fix this. Thank you!
@jackmcdade Sorry to write to you guys directly, but this is a critical issue and I am very frustrated. Nobody seems to work on this despite having done some initial work to help fixing this bug. I wouldn't be so impatient if it wasn't a critical bug.
The original issue is quite different from what Felix is explaining. They're not even the same tags.
Regarding the registration form, you never showed the template where you're trying to output the success or errors. Both success and errors are available on the tag. So if you're not using the tag, they won't just magically be available.
They do live in the session though, so you can use the session tag to grab them:
{{ if {session:user.register.success} }}
{{ session:user.registesr.success }}
{{ /if }}
We'll update the docs.
As for the form thing, it looks like some weirdness when you use ?? instead of or. Changing {{ form:create in="{ handle ?? form:handle }" }} to in="{ handle or form:handle }" fixes it. I'll open a separate issue.
Activity
duncanmcclean commentedon May 10, 2021
So what you're saying is that you lose the query parameters whenever you are redirected from the
user:register_form, correct?If that's the case, I don't seem to be able to reproduce it...
felixstoessel commentedon May 20, 2021
I have the same issue in a different context:
This worked fine some Statamic versions ago. Right now on 3.1.14, I don't get any success or error messages. When I have a form with some server side validations, those error messages also do not appear anymore. I tested this part of my code very intensively and there was nothing changed except updating Statamic with its dependencies.
felixstoessel commentedon May 21, 2021
Soo, I tested the issue and I have some observations:
.htaccess, but every redirect there has a 301. If this redirect is not normal, then this should be the issue. Because when redirecting with 301/302, we lose the response data./!/forms/contact, wherecontactin my form handle.But I am too stupid to fix this, because I have no clue where to look...
felixstoessel commentedon May 21, 2021
Well, the 302 redirect is the normal redirect by
back(). I get my error messages insideformFailure()insideFormController.php. So I assume the issue is after this code, maybe there is some new middleware logic that strips data?felixstoessel commentedon May 21, 2021
So, I tested every PHP part and in Antlers, right before me calling
{{ errors }}{{ value }}{{ /errors }}, I created a dump:So the error messages are there, but somehow the augmentation of
errorsdoes not work.felixstoessel commentedon May 25, 2021
Is there anyone watching this issue? I find this bug to be important, because it really makes forms completely useless and very bad for customers (because of no feedback like success or errors)...
felixstoessel commentedon May 27, 2021
@jasonvarga Could you help with that? I did more debugging than I wanted, but I have no idea how things are internally connected to fix this. Thank you!
felixstoessel commentedon Jun 9, 2021
@jackmcdade Sorry to write to you guys directly, but this is a critical issue and I am very frustrated. Nobody seems to work on this despite having done some initial work to help fixing this bug. I wouldn't be so impatient if it wasn't a critical bug.
jasonvarga commentedon Jun 11, 2021
The original issue is quite different from what Felix is explaining. They're not even the same tags.
Regarding the registration form, you never showed the template where you're trying to output the success or errors. Both
successanderrorsare available on the tag. So if you're not using the tag, they won't just magically be available.They do live in the session though, so you can use the
sessiontag to grab them:We'll update the docs.
As for the form thing, it looks like some weirdness when you use
??instead ofor. Changing{{ form:create in="{ handle ?? form:handle }" }}toin="{ handle or form:handle }"fixes it. I'll open a separate issue.