text input field update based on another text input

I can't seem to get this working. I want to have one TextInput that's updated when another one is changed by the user. .
TextInput::make('payment_before_discount')
->prefix('$')
->live(true)
->reactive()
->default($this->paymentData['total_before_discounts']),

TextInput::make('payment_amount')
->label('Net Payment Amount')
->disabled()
->prefix('$')
->live()
->reactive()
TextInput::make('payment_before_discount')
->prefix('$')
->live(true)
->reactive()
->default($this->paymentData['total_before_discounts']),

TextInput::make('payment_amount')
->label('Net Payment Amount')
->disabled()
->prefix('$')
->live()
->reactive()
When a user changes the payment_before_discount input, I want the value of the payment_amount input to update as well. I've tried using afterStateUpdated and also the default method, but can't seem to get it working.
1 Reply
johnnie_littleshoes
something like this?
->afterStateUpdated( fn(Set $set, $state) => $set('payment_amount', $state))
->afterStateUpdated( fn(Set $set, $state) => $set('payment_amount', $state))
live() is the same as reactive(), but newer and more aligned with Livewire
Want results from more Discord servers?
Add your server