Set other form fields from within a Livewire component as field

How can i set the value of a form field from a livewire component that is inside a form.
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make('')
->compact()
->columnSpan(1)
->columns(2)
->schema([
Forms\Components\Livewire::make(LiveSearchComponent::class),

Forms\Components\TextInput::make('name')
])

//Livewire component
class LiveSearchComponent extends Component
{
public function render()
{
return view('livewire.live-search-component');
}
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make('')
->compact()
->columnSpan(1)
->columns(2)
->schema([
Forms\Components\Livewire::make(LiveSearchComponent::class),

Forms\Components\TextInput::make('name')
])

//Livewire component
class LiveSearchComponent extends Component
{
public function render()
{
return view('livewire.live-search-component');
}
}
how do i access the $form inside LiveSearchComponent, i want to set 'name' field from within LiveSearchComponent. Is there a way to do it?
2 Replies
n0nsensei95
n0nsensei95OP10mo ago
not exactly, i want access the form/livewire outside of LiveSearchComponent, not the actual record
Want results from more Discord servers?
Add your server