SEMICOLON;
SEMICOLON;
Explore posts from servers
FFilament
Created by SEMICOLON; on 8/7/2023 in #❓┊help
Fill form data when a specific field changes
Hello, I have this form:
$form->schema([
Forms\Components\TextInput::make('hourly_price')
->label(trans('admin.room.hourly_price'))
->numeric()
->default(0)
->required(),
Forms\Components\TextInput::make('daily_price')
->label(trans('admin.room.daily_price'))
->numeric()
->default(0)
->required(),
Forms\Components\TextInput::make('monthly_price')
->label(trans('admin.room.monthly_price'))
->numeric()
->default(0)
->required(),
]);
$form->schema([
Forms\Components\TextInput::make('hourly_price')
->label(trans('admin.room.hourly_price'))
->numeric()
->default(0)
->required(),
Forms\Components\TextInput::make('daily_price')
->label(trans('admin.room.daily_price'))
->numeric()
->default(0)
->required(),
Forms\Components\TextInput::make('monthly_price')
->label(trans('admin.room.monthly_price'))
->numeric()
->default(0)
->required(),
]);
I want when hourly_price value changes I calculate the daily_price and monthly_price and fill them automatically. How can I implement this? I tried using afterStateUpdated but it seems that I cannot access all the form data and manipulate the values.
11 replies