Form in custom page validation not working
class Checkout extends Page implements HasForms
{
use InteractsWithForms;
....
protected static string $view = 'filament.admin.resources.invoice-resource.pages.checkout';
public ?array $data = [];
public function form(Form $form): Form
{
return $form
->statePath('data')
->schema([
Forms\Components\Section::make('Payment Information')
->schema([
Forms\Components\Select::make('paymentMethod')
->label('Payment Method')
->options($this->getPaymentMethods())
->live()
->required(),
Forms\Components\Section::make(fn($get) => 'Payment with ' . $get('paymentMethod'))
->visible(fn($get) => $get('paymentMethod') !== null)
->schema(fn($get) => is_null($get('paymentMethod')) ? [] : $this->factory->resolve($get('paymentMethod'))->form()),
]),
]);
}class Checkout extends Page implements HasForms
{
use InteractsWithForms;
....
protected static string $view = 'filament.admin.resources.invoice-resource.pages.checkout';
public ?array $data = [];
public function form(Form $form): Form
{
return $form
->statePath('data')
->schema([
Forms\Components\Section::make('Payment Information')
->schema([
Forms\Components\Select::make('paymentMethod')
->label('Payment Method')
->options($this->getPaymentMethods())
->live()
->required(),
Forms\Components\Section::make(fn($get) => 'Payment with ' . $get('paymentMethod'))
->visible(fn($get) => $get('paymentMethod') !== null)
->schema(fn($get) => is_null($get('paymentMethod')) ? [] : $this->factory->resolve($get('paymentMethod'))->form()),
]),
]);
}the above code works but when submitting the form validation doesn't work even if the form is valid
what im i doing wrong thanks
