wire:model I have wire:model working for
<input wire:model="additionalData.testcompletedby" type="text" required="" class="text-input-box" name="testcompletedby">
<input type="radio" wire:model="additionalData.soundersHeard" value="yes"> Yes
But will not work (store the data) for
<x-form.yes-no :parts="[
'model' => 'additionalData.soundersheard',
'label' => 'Sounders heard',
'span' => '',
'na' => '',
'conditionalParent' => '',
]"
></x-form.yes-no>
Any suggestions on what to look for?
If you're using Livewire 3, then you'll probably need to add wire:model.live="property".
Like this (as still the same)
<x-form.yes-no wire:model.live="property" :parts="[
'model' => 'additionalData.soundersheard',
'label' => 'Sounders heard',
'span' => '',
'na' => '',
'conditionalParent' => '',
]"
></x-form.yes-no>
In the first example, it doesn't look like you actually had wire:model anywhere.
In the second, you were trying to bind it to something called "property".
In both cases, you're trying to use wire:model on your custom "x-form.yes-no" component, which I"m pretty sure won't work.
You need to attach the wire:model directly to an input (e.g. , , , etc).
I have also tried and does not work
<x-form.yes-no :parts="[
'wire:model' => 'additionalData.soundersheard',
'label' => 'Sounders heard',
'span' => '',
'na' => '',
'conditionalParent' => '',
]"
></x-form.yes-no>
@mikethelad How can we possibly know without information about that component?
This is my yes no component
@if($label)
<label for="{{ $model }}" class="form-label">{{ $label }}</label>
@endif
<div class="flex mt-2">
@foreach($options as $option)
<label
x-on:click="[activeOption = '{{ $option }}', @if( $conditionalParent ) $wire.updateConditionalField(['{{ $model }}', {{ $model }}.value]) @endif]"
class="standard-button w-20 mr-4 text-blue"
:class="['{{ $option }}' == 'Yes' ? 'bg-lime-400' : '{{ $option }}' == 'No' ? 'bg-red-400' : 'bg-gray-400', activeOption == '{{ $option }}' ? '' : 'opacity-40' ]"
>
{{ $option }}
<input class="hidden" type="radio" name="{{ $model }}" wire:model.defer="{{ $model }}" value="{{ $option }}"/>
</label>
@endforeach
</div>
</div>
Your component is wire model to the :model attribute
'model' => 'additionalData.soundersheard',
However, I don't see how your component can read from a parts array.
Suggest you consult the documentation for the component
Please sign in or create an account to participate in this conversation.