F
Filament6mo ago
adnn

Split a Resource Form in multiple sub navigations?

I have a resource that requires a lot of form inputs for various things related to it. I would like to separate the Form into the navigation tabs so instead of having brand/2/edit and listing all fields at once it would be brand/2/edit/content, edit/administration, etc. while using the same model, not a relationship is this possible? if yes what's the proper way to go about it?
4 Replies
Ron
Ron6mo ago
I built something similar. I typed up a readme with some source snippets to hopefully help you get started. https://github.com/ronfuller/filament-multisection-forms/blob/main/README.md Some things to consider: Validation per multi-section form page , vs validation for all form fields (which would be on different pages)
$livewire = $this->form->getLivewire();
// Get all form rules
$rules = $livewire->getRules();
// Only validate against the rules needed for the section
$onlyRules = ['data.meta.rent', 'data.meta.unit', 'data.property_id'];

$livewire->validate(\Arr::only($rules, $onlyRules));
$livewire = $this->form->getLivewire();
// Get all form rules
$rules = $livewire->getRules();
// Only validate against the rules needed for the section
$onlyRules = ['data.meta.rent', 'data.meta.unit', 'data.property_id'];

$livewire->validate(\Arr::only($rules, $onlyRules));
Allowing the enter key to be used to save the form on a section
->extraInputAttributes(['x-on:keyup.enter' => '$wire.saveApplication()'])
->extraInputAttributes(['x-on:keyup.enter' => '$wire.saveApplication()'])
GitHub
filament-multisection-forms/README.md at main · ronfuller/filament-...
Contribute to ronfuller/filament-multisection-forms development by creating an account on GitHub.
No description
Ron
Ron6mo ago
@adnn This is how top position subnavigation looks
No description
adnn
adnnOP6mo ago
Wow this is brilliant, thank you so much! Your Filament looks insane, never knew you could customize it that far, super cool
Ron
Ron6mo ago
@adnn happy to help. Let me know if you get stuck or have questions. I am using Filament as the entire app, not just admin and have found it really provides for about every use case I can throw at it. For learning custom pages and form handling, i referenced this repo: https://github.com/andrewdwallo/erpsaas from @Andrew Wallo which is a great learning resource.
GitHub
GitHub - andrewdwallo/erpsaas: A Laravel and Filament-powered accou...
A Laravel and Filament-powered accounting platform, crafting a modern and automated solution for financial management. - andrewdwallo/erpsaas
Want results from more Discord servers?
Add your server