Live update

i have a amount field that keep amount and i have a button that pays the amount that has been entered i want to live update the button lable to the input amount TextInput::make('amount'), protected function getFormActions(): array { return [ $this->getSaveFormAction() ->label(function(){ return "Pay Now $" . ;
})
]; }
5 Replies
Vp
Vp6mo ago
Something like this
TextInput::make('amount')
->reactive(),

$this->getSaveFormAction()
->label(function(Closure $get){
return "Pay Now $" . $get['amount'];
})
TextInput::make('amount')
->reactive(),

$this->getSaveFormAction()
->label(function(Closure $get){
return "Pay Now $" . $get['amount'];
})
GHOST-117
GHOST-1176mo ago
I am getting this error Target [Closure] is not instantiable.
Vp
Vp6mo ago
Did you use this use Closure; or you can also use function (callable $get)
GHOST-117
GHOST-1176mo ago
both Closure and callable giving me error
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()
->label(function (callable $get) {
dd("esdrtyu");
})

];
}
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()
->label(function (callable $get) {
dd("esdrtyu");
})

];
}
TextInput::make('amount')->reactive() ->label('Amount')->required(), protected function getFormActions(): array { return [ $this->getSaveFormAction() ->label(function () { return "Pay Now $" . $this->data["amount"];
// dd("esdrtyu"); })
]; } now working ``` its working