feat: configurable description maxLength and boolean required validation fix [3.x]#134
Merged
ManukMinasyan merged 3 commits into3.xfrom Apr 15, 2026
Conversation
…ion fix
Make the description textarea maxLength configurable via
config('custom-fields.fields.description_max_length') with a 255 default,
allowing longer descriptions for field types like Agreement.
Fix required validation for checkbox/toggle fields: Laravel's `required`
rule passes on `false`, so a required boolean could be submitted unchecked.
Now uses `accepted` rule instead, and `markAsRequired()` for the visual
asterisk without injecting the broken `required` validation rule.
There was a problem hiding this comment.
Pull request overview
Adds configurability for the management UI description length limit, and fixes required validation for boolean custom fields (checkbox/toggle) by switching from required to accepted while preserving required UI indicators.
Changes:
- Introduce
custom-fields.fields.description_max_lengthconfig (default 255) and apply it to field/section description inputs. - Fix required boolean validation by using Laravel’s
acceptedrule (and avoiding the ineffectiverequiredrule forfalse). - Add feature tests covering required checkbox/toggle behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| config/custom-fields.php | Adds fields.description_max_length config key. |
| src/Filament/Management/Schemas/FieldForm.php | Uses config-driven max length for field description textarea. |
| src/Filament/Management/Schemas/SectionForm.php | Uses config-driven max length for section description textarea. |
| src/Filament/Integration/Base/AbstractFormComponent.php | Uses markAsRequired() for required boolean fields instead of required(). |
| src/Services/ValidationService.php | Adds accepted rule for required boolean fields. |
| tests/Feature/Integration/ValidationCapabilitiesTest.php | Adds tests for required boolean validation. |
Section descriptions use a VARCHAR(255) column, so sharing the same config key with field descriptions (stored in JSON) could cause DB errors if increased beyond 255. Separate keys make the constraint explicit.
Sections aren't fields, so section config shouldn't live under the fields key. Follows the existing pattern of top-level keys for separate concerns (management, currency, database).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
requiredrule passes onfalse, so a "required" checkbox/toggle could be submitted unchecked. Now uses theacceptedrule (rejectsfalse/0/null) andmarkAsRequired()for the visual asterisk without injecting the brokenrequiredvalidation rule.Config keys
Changes
config/custom-fields.phpfields.description_max_lengthandsections.description_max_lengthsrc/Filament/Management/Schemas/FieldForm.phpfields.description_max_lengthconfigsrc/Filament/Management/Schemas/SectionForm.phpsections.description_max_lengthconfigsrc/Filament/Integration/Base/AbstractFormComponent.phpmarkAsRequired()for boolean fieldssrc/Services/ValidationService.phpacceptedrule for required boolean fieldstests/Feature/Integration/ValidationCapabilitiesTest.phpTest plan
false-> validation errortrue-> passesfalse-> validation errortrue-> passesfalse-> passes (regression guard)