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

ViewData["ValidationErrors"] should be a dictionary #59

Closed
apexdodge opened this issue Jan 31, 2023 · 1 comment
Closed

ViewData["ValidationErrors"] should be a dictionary #59

apexdodge opened this issue Jan 31, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@apexdodge
Copy link
Contributor

This line here:

ViewData["ValidationErrors"] = errors;

is supposed to be a dictionary:

ViewData["ValidationErrors"] = errors?.ToDictionary(k => k.PropertyName, v => v.ErrorMessage);

Otherwise you cannot conveniently access the error for the field by developer name in the liquid template, example:

{{ ViewData["ValidationErrors"]["name"] }}

@apexdodge apexdodge added bug Something isn't working good first issue Good for newcomers labels Jan 31, 2023
@apexdodge apexdodge added this to the v0.9.5 milestone Jan 31, 2023
@apexdodge
Copy link
Contributor Author

Merged into dev

@apexdodge apexdodge modified the milestones: v0.9.5, v1.0.0 Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant