hellow guys, sometimes in my case i have foreach my data, and the result ill take to set the input value as default. the problem on decralating variable and the value. i want $idname and $name fill by result of foreach. what should i do ?
How get default value input wire:model.lazy
Hi,
I’m sure there is a better solution but if you’re using Alpine you could do the following,
<input type="text" wire:model.lazy="name" x-data x-init="@this.set('name', '{{ $item->toolname }}')">
However it looks like what you’re trying to do will reassign the name property everytime you loop over an item. It might be best to create a seperate Livewire component for each tool as then each will have its own seperate properties.
Hope this helps.
Do you have a $tools
public property? Is it bound to a model, if so you need to include validation rules to bind it to an input?