filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.4k stars 2.97k forks source link

`min`/`max/`required` not working for components in concealable component. #14504

Closed MarkKremer closed 1 month ago

MarkKremer commented 1 month ago

Package

filament/forms

Package Version

v3.2.117

Laravel Version

v11.27.2

Livewire Version

v3.5.6

PHP Version

8.2

Problem description

TextInput (and possibly other components) do not apply a front-end min/max/required attribute when nested in a concealable component, even though the fields are at that moment not concealed.

Expected behavior

Visible form elements have the min/max/required applied so the browser's native form element works as required. For example, when clicking the arrows on a number field with a min value, it will not go below the min value. Other browser validation works too.

Steps to reproduce

  1. Create a TextInput component with a min attribute inside a concealable component. E.g,.
    Tabs::make('Heading')
    ->tabs([
        Tabs\Tab::make('User info')
            ->schema([
                TextInput::make('age')
                    ->statePath('age')
                    ->numeric()
                    ->minValue(18),
            ]),
    ]),
  2. See in the browser that it does not have a min attribute applied even through the field is visible.

In the reproduction repository:

  1. Composer install, migrate and seed etc.
  2. Go to http://127.0.0.1:8000/admin/users/1/edit and login.
  3. See that the height field is restricted to a min value of 100 (not nested in a concealable component) and the age field is not even though it does have a min of 18.

Reproduction repository (issue will be closed if this is not valid)

https://github.com/MarkKremer/filament-pr

Relevant log output

No response

Donate 💰 to fund this issue

Fund with Polar

danharrin commented 1 month ago

Please search the issues/PRs, this has been iterated on many times. We can't use attributes like this as they causes browser validation errors to be concealed when the form is submitted