I'm having trouble implementing a suffixAction on a PhoneInput component to copy the value from one field to another. Below is the code snippet that I'm using. The suffixAction button appears next to the contact_number field, but when clicked, it does not copy the value to the whatsapp_number field as expected.
Code Snippet:
use Filament\Forms\Components\Button;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Fieldset;
use Filament\Forms\Components\Card;
use Filament\Forms\Components\Grid;
use Ysfkaya\FilamentPhoneInput\Forms\PhoneInput;
use Filament\Forms\Components\Actions\Action;
$form->schema([
Card::make()
->schema([
Fieldset::make('Contact Information')
->schema([
Grid::make(2)
->schema([
PhoneInput::make('contact_number')
->label('Contact Number')
->required()
->reactive()
->suffixAction(
Action::make('copyContactToWhatsApp')
->icon('heroicon-m-clipboard')
->action(function (Forms\Set $set, $state) {
$set('whatsapp_number', $state);
})
),
PhoneInput::make('whatsapp_number')
->label('WhatsApp Number')
->reactive(),
]),
])
])
]);
Expected Behavior:
Clicking the suffixAction button should copy the value from the contact_number field to the whatsapp_number field.
Actual Behavior:
The suffixAction button appears, but clicking it does not copy the value as expected.
Title:
Suffix Action Not Working on
PhoneInput
ComponentDescription:
I'm having trouble implementing a
suffixAction
on aPhoneInput
component to copy the value from one field to another. Below is the code snippet that I'm using. ThesuffixAction
button appears next to thecontact_number
field, but when clicked, it does not copy the value to thewhatsapp_number
field as expected.Code Snippet:
Expected Behavior:
Clicking the
suffixAction
button should copy the value from thecontact_number
field to thewhatsapp_number
field.Actual Behavior:
The
suffixAction
button appears, but clicking it does not copy the value as expected.