Skip to content

Multiple validation errors are not populated correctly #772

@peaklabs-dev

Description

@peaklabs-dev

Inertia adapter(s) affected

  • React
  • Vue 3
  • Svelte
  • Not Applicable

JS package version

2.0.5

Backend stack (optional)

No response

Describe the problem

I'm not sure if I'm missing something but when there are multiple validation errors, Laravel should return an array of validation errors see https://laravel.com/docs/12.x/validation#validation-error-response-format. Currently, in the errors prop, there is always only one validation error the first one.

Steps to reproduce

Create a form in Svelte with a text input and the following rule: "username" => ["required", "alpha:ascii", "min:1", "max:3"]. Add a number, make it longer than three and see only the alpha rule error appear. Is this intended, or am I missing something? How can I show all validation errors each on a newline for example?

This is also true with vue.js:

Prop:
Image

Instead of

username: [
    "The username field must only contain letters.",
    "The username field must not be greater than 3 characters"
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions