put the error message outside of the mce div
Livewire ignore and validation does not display errors
Hello,
Using Laravel 10 and livewire 3.
I have a form with a tinyMce textarea.
I have to put wire:ignore on the div otherwise, tinyMce does not work.
The field is required, but when I submit the form the error is not being displayed.
I can see in Firebug, that the error it is being returned, it just does not display.
In my form component:
protected $messages = [
other messages...
'short_desc.required' => 'The short desctiption is required',
];
public function rules()
{
return [
... other rules
'short_desc' => 'required',
];
}
In my blade:
<div class="form-group required" wire:ignore>
<label class="form-label" for="short-desc">Coffee Short Description</label>
<textarea class="form-control @error('form.short_desc') is-invalid @enderror" wire:model="form.short_desc" rows="4"></textarea>
@error('form.short_desc)
<div class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</div>
@enderror
</div>
On form submission in Firebug:
"errors":{"form.short_desc":["The short description is required"]}
Yet, the error is not displayed. I guess it is the wire:ignore so how do I display the error in this case?
I also tried to move the error display outside of the wire:ignore div, still no display:
<div class="form-group required" wire:ignore>
<label class="form-label" for="short-desc">Coffee Short Description</label>
<textarea class="form-control @error('form.short_desc') is-invalid @enderror" wire:model="form.short_desc" rows="4"></textarea>
<small class="form-text text-muted">Displays on shop for each coffee</small>
</div>
@error('form.short_desc)
<div class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</div>
@enderror
This option, by the way, doesn't work when I remove the wire:ignore either. It seems the error needs to be inside the parent div ("form-group")
Please or to participate in this conversation.