statamic / workshop

Create and edit entries, pages, and globals on the front-end of your site without the control panel.
https://statamic.com/marketplace/addons/workshop
3 stars 2 forks source link

Improve clarify of error messages #23

Open alehandrof opened 6 years ago

alehandrof commented 6 years ago

The error messages that Workshop outputs are pretty iffy. Here's an example:

The fields.title field is required.

I came across the same issue on Profiler. I spoke to Erin about it. He suspects it's a broader Statamic issue, but I opened an issue here for the moment. Either it's not possible to edit the error responses, or how to do it is not documented.

There's an option to create individual error messages per field (documented here), but this is an imperfect solution, because it's unclear which validation has failed. Perhaps a field is both required and needs to be validated as an email. That requires two different responses.

Let me know if I've missed anything!

alehandrof commented 6 years ago

Just for reference, in v1 you could do something like this:

{{ raven:errors }}
  {{ missing }}
    <li><strong>{{ field|deslugify|title }}</strong> is required</li>
  {{ /missing }}
  {{ invalid }}
    <li>{{ message }}</li>
  {{ /invalid }}
{{ /raven:errors }}