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 Apply Authorization on Create Option Action for Select Field
Sometimes, when we need to test our application locally, we always have to fill forms manually. Let's take the Filament approach and achieve this with more accurate data.
Bring the sticky actions back form filament v2
get translatable attribute in a relationships
Unrequire fields recursively when saving as draft