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

[4.x] Only use site language for form submission validation messages if submitted from front-end #9383

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

jasonvarga
Copy link
Member

When submitting a form on the front-end, validation messages will be in the appropriate site's language.

However, some people are using this same URL to create form submissions in a headless fashion, without using a form:create tag on the front-end.
Additionally, they are setting the app locale manually in a middleware.

This PR will make it so that the validation language is only used if submitted from the frontend. Otherwise it'll just fall back to the default locale (not the language of the default site like it does now).

It's worth noting that URL::previous() will fall back to the the home page when there's no referrer header, where as session()->previousUrl() will fall back to null, which is what we need here.

@jasonvarga jasonvarga merged commit ec9e5c5 into 4.x Jan 23, 2024
36 checks passed
@jasonvarga jasonvarga deleted the form-validation-lang branch January 23, 2024 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant