LIGHT
LIGHT

Reputation: 5712

Access Parent Schema Value inside Repeater - Filament

I am trying to access field_1 value inside the repeater

return $form->schema([
    Select::make('field_1')->reactive()->options(['a','b','c']),
    Repeater::make('repeater_1')->schema([
        TextInput::make('field_2')->default(fn (Closure $get) => $get('field_1')),
    ]),
]);

Upvotes: 2

Views: 3677

Answers (1)

Dan Harrin
Dan Harrin

Reputation: 957

TextInput::make('field_2')->default(fn (Closure $get) => $get('../../field_1')),

https://filamentphp.com/docs/2.x/forms/fields#using-get-to-access-parent-field-values

Upvotes: 6

Related Questions