Bypass required when save as draft
- Published: 28 May 2025 Updated: 28 May 2025
Unrequire fields recursively when saving as draft
Imagine you have a massive form with two buttons: Save as Draft and Submit, where all fields or a lot of them are required to submit.
You may want to let users save the form as draft even if it's incomplete.
Here's what you could do:
Here, the unrequireFields method recursively remove the required for all the fields.
It also mark them as required thanks to the markAsRequired method in order to have the red asterisk even if the fields are not really required.
Related Tricks:
how to use a resource with multiple models
Form Builder lets you build dynamic, versioned forms in Filament and attach them to any model. Responses are stored in JSON with zero boilerplate.
Unrequire fields recursively when saving as draft
Custom copy action, click the icon to copy the content
make all Field or any components translatable