Livewire: Use Child Component Form on Modal

I’m building a modal that can have multiple forms, depending on the number of sets. This is the structure.

workouts.edit-logger.blade.php

<div>
    <x-card title="{{ $planner->exercise->name }}">
        <table class="min-w-full divide-y divide-gray-200 dark:divide-neutral-700">
            <thead>
                <tr>
                    <th scope="col" class="px-2 py-3 text-xs font-medium text-gray-500 uppercase text-start dark:text-neutral-500">Set</th>
                    <th scope="col" class="px-2 py-3 text-xs font-medium text-gray-500 uppercase text-start dark:text-neutral-500">Reps</th>
                    <th scope="col" class="px-2 py-3 text-xs font-medium text-gray-500 uppercase text-start dark:text-neutral-500">Load</th>
                    <th scope="col" class="px-2 py-3 text-xs font-medium text-gray-500 uppercase text-start dark:text-neutral-500">Reps In Reserve</th>
                    <th scope="col" class="px-2 py-3 text-xs font-medium text-gray-500 uppercase text-start dark:text-neutral-500">Notes</th>
                </tr>
            </thead>
            <tbody class="divide-y divide-gray-200 dark:divide-neutral-700">
                @foreach ($planner->loggers as $logger)
                    <livewire:workouts.edit-set :$logger :key="$logger->id" />
                @endforeach
            </tbody>
        </table> 
        <x-slot name="footer">
            <div class="flex justify-between gap-x-4">
                <x-button flat label="Cancel" wire:click="closeModal" />
            </div>
        </x-slot>
    </x-card>
</div>

EditLogger.php

<?php

namespace AppLivewireWorkouts;

use AppModelsWorkoutExercise;
use LivewireUIModalModalComponent;

class EditLogger extends ModalComponent
{    
    // public int $planner;
    public WorkoutExercise $planner;

    public function mount(WorkoutExercise $planner)
    {
        $this->planner = $planner;
    }

    public function render()
    {
        return view('livewire.workouts.edit-logger');
    }
}

workouts.edit-set.blade.php

<?php

use AppLivewireFormsLoggerForm;
use AppModelsWorkoutExerciseLogger;
use LivewireAttributesModelable;
use LivewireVoltComponent;

new class extends Component {
    #[Modelable] 
    public LoggerForm $form;

    public function mount(WorkoutExerciseLogger $logger)
    {
        $this->form->setLogger($logger);
    }

    public function save()
    {
        $this->form->update();
        session()->flash('status', 'Successfully updated.');
    }
}; ?>

<div>
    <form wire:submit="save" >
        <tr class="hover:bg-gray-100 dark:hover:bg-neutral-700">
            <td class="px-2 py-4 text-sm font-medium text-gray-800 whitespace-nowrap dark:text-neutral-200">
                <p>{{ $this->form->set }}</p>
            </td>
            <td class="px-2 py-4 text-sm font-medium text-gray-800 whitespace-nowrap dark:text-neutral-200">
                <x-inputs.number id="pr{{ $this->form->set }}" wire.model="form.performedReps" placeholder="0" />
            </td>
            <td class="px-2 py-4 text-sm text-gray-800 whitespace-nowrap dark:text-neutral-200">
                <x-inputs.number id="l{{ $this->form->set }}" wire:model="form.load" placeholder="0" />
            </td>
            <td class="px-2 py-4 text-sm text-gray-800 whitespace-nowrap dark:text-neutral-200">
                <x-inputs.number id="rir{{ $this->form->set }}" wire:model="form.repsInReserve" placeholder="0" />
            </td>
            <td class="px-2 py-4 text-sm text-gray-800 whitespace-nowrap dark:text-neutral-200">
                <x-input id="n{{ $this->form->set }}" wire:model="form.notes" placeholder="Add notes if needed" />
            </td>
            <td class="px-2 py-4 text-sm text-gray-800 whitespace-nowrap dark:text-neutral-200">
                <x-button.circle type="submit" icon="check-circle" green interaction="negative" label="Save"/>
            </td>
        </tr>
    </form>
</div>

LoggerForm.php

<?php

namespace AppLivewireForms;

use AppModelsWorkoutExerciseLogger;
use LivewireAttributesValidate;
use LivewireForm;

class LoggerForm extends Form
{
    public WorkoutExerciseLogger $logger;

    #[Validate('required')]
    public $set;
 
    #[Validate('required')]
    public $load;

    #[Validate('required')]
    public $performedReps;
 
    public $repsInReserve;
 
    public $notes = '';

    public function setLogger(WorkoutExerciseLogger $logger)
    {
        $this->logger = $logger;
 
        $this->set           = $logger->set;
        $this->load          = $logger->load;
        $this->performedReps = $logger->performedReps;
        $this->repsInReserve = $logger->repsInReserve;
        $this->notes         = $logger->notes;
    }

    public function update()
    {
        $this->validate();

        $this->logger->update(
            $this->all()
        );
    }
}

I’m getting the following console warning for all form fields: Livewire: [wire:model=”form.repsInReserve”] property does not exist on component: [workouts.edit-logger]

And the form is not being built on the page
as you can see here

I’m new to Livewire and I really don’t understand the issue. Am I overusing components? How can I solve this issue?

I’ve tried moving to a Livewire component instad of a Volt component. It didn’t work.

New contributor

Rui Miguel Bastos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật