Open dhensby opened 9 years ago
~~This is actually a setting in src/Forms/Form.php#183
called redirectToFormOnValidationError
which is by default set to false
.
Do you think this should be changed? I agree that redirecting back to the form is the more logical behaviour.
I couldn't find any occurrences of the property being used, at least in framework
.~~
redirectToFormOnValidationError
controls if the ID of the form is added to the URL as an anchor, I believe, and not whether to ignore the BackURL or not. the fact the BackURL is used of form failure in either case is an error.
Ah I see, you're right.
Reproduced on SS 4.3.x-dev
Example: http://www.silverstripe.org/Security/login?BackURL=/home
If you navigate to a login form with a
BackURL
specified in the URL and then submit the form without entering any data, the form redirects you to theBackURL
location.This is due to
Controller::redirectBack()
looking atBackURL
for the current request andForm::getValidationErrorResponse()
not taking into account a failed validation should probably redirect to the page with the form, rather than theBackURL
NB: to replicate you need to turn off HTML5 browser validation on inputs