protonemedia / laravel-form-components

A set of Blade components to rapidly build forms with Tailwind CSS (v1.0 and v2.0) and Bootstrap 4/5. Supports validation, model binding, default values, translations, Laravel Livewire, includes default vendor styling and fully customizable!
https://protone.media/blog/laravel-form-components-to-rapidly-build-forms-with-tailwind-css-and-bootstrap-4
MIT License
814 stars 105 forks source link

Output sub-item form-errors messages when they exist #94

Open Patabugen opened 2 years ago

Patabugen commented 2 years ago

When validating an array Laravel lets us validate array items using the fieldname.* syntax which can result in the error bag containing messages which are returned as fieldname.<array_index>.

These are not output at the moment, this PR is a simple fix to (recursively) output them if they exist.

I've just extended the <x-form-errors> component to output them as their own messages, an enhancement might be to make them smarter or display in a more inline way..

There were no existing tests for form-errors, so apologies for not adding one and starting those.