Custom form component

Hello there,
For a field called main_subject_id, I created a custom form component and added a Livewire component. The reason is because the user should be able to collapse a tree (built on the nested-set package, see screenshot) and choose a certain value . I have the frontend working but I don't know how to write the chosen value to the DB when submitting.

If I understand correctly, I have to bind the new value to the Alpine js variable?

I have this now in my form component file:
<x-dynamic-component
    :component="$getFieldWrapperView()"
    :field="$field"
>
    <div x-data="{ state: $wire.$entangle('mainSubjectId') }" >
        <livewire:main-subject-tree-dropdown />
    </div>
</x-dynamic-component>
Screenshot_2024-11-07_at_09.12.14.png
Was this page helpful?