Update information of the explanation field based on the Code given (real time)
Hi everyone. I am building a model that allows an user to update an code. when live editing this code and pressing a button I want to load some explanation/data before the user can save this. So I was wondering how can I modify the second field based on the data in the first one when the example button is pressed?
For example:
1 -> The user adds an code
2 -> Presses the example button
3 -> The information in the Explanation field is updated (not saved yet).
I started with something like this (screenshot for what I want is below):
EditAction::make()
->form([
TextInput::make('code_one')
->required()
->numeric()
->minValue(1000000000)
->maxValue(9999999999),
// Below need to be updated based on an action (but not yet saved)
TextInput::make('explanation')
->readOnly()
])->modalContent(
// Show some information
fn($record) => \view('filament.resources.data.modals.some-info', ['item' => $record]
))
->extraModalFooterActions(fn (Action $action): array => [
// This is incorrect
$action->makeModalSubmitAction('Example ', arguments: ['another' => false]),
])->action(function (array $data, array $arguments) {
})
),
1 Reply