Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

patrickfreitasdev's avatar

Inertia useForm errors coming empty from the validation rule

Hey there

I am in middle of a puzzle here.

I am using React JS and Inertia, for some reason when I make a POST request to my controller the useForm > errors is not returning anything.

My react component

My request

public function rules(): array
    {
        return [
            'logo' => ['required'],
            'test' => [ 'required',
            'string',
            'lowercase',
            'email',
            'max:255']
        ];
    }

Note, I added the "test" just for sake of testing, the logo I am sending it as not required / empty as well to validate, when I dd($this->all) the rules{} I get the screen just fine.

When I inspect the console for console.log(errors); it just returns {}

I believe I am missing something really basic, my login / register form was bringing the validation just fine but when I was writing this question I tested it again to compare the props: and noticed neither the previous worked forms are now not bringing anything back on error.email for example.

0 likes
2 replies
JussiMannisto's avatar

Does validation actually fail? Have you type-hinted your custom form request class in the controller method?

when I dd($this->all) the rules{} I get the screen just fine.

What does this mean?

patrickfreitasdev's avatar

Hey @jussimannisto

Thanks for reply.

yes, validation was working. I wanted to mean that when I say I dd() to confirm the validation works.

But I could find that out. Beginner mistake...

When I worked on HandleInertiaRequest I implemented a new rule and forgot to add to array the

...parent::share($request),

So the errors props were never passed, only the custom ones.

All good now, thanks

Please or to participate in this conversation.