phydeaux
Repeater - deletable except for first item
Is it possible to have repeater items have the delete action except for the first entry? In this example, a job application with a repeater for employment history but at least one is required. This is a form in a standalone Livewire component and not in a Filament panel. I'm adding an empty entry to the repeater in the component's
mount()
method and that works fine. I'd like that one to always be present but if they accidentally add a one (2nd, 3rd, or 17th) without meaning to, there's no way to remove it and those fields fail validation as required.
So can you either disable delete or hide the delete icon for that first one? Or, if that's not possible, is there a way to filter out fully empty entries before they go through validation?6 replies
Change repeater field label based on other field value
I have a wizard form and there's a repeater on step 4. I'd like to change the label of one of the fields inside the repeater based on the value of a field on step 1. It works fine if it's outside the repeater but the $get('fieldname') comes back NULL if it's inside. Is there a way to pass that field value into the repeater somehow so it can be accessed and passed into the label() closure?
I can provide code snippets if necessary.
4 replies
Live select field not found with $get
In a create form, I have a select field called base_position_id defined as
Right below that, I have this inside a Split and a Section:
which works perfectly. So I know base_position_id is getting set correctly and should be available.
But a little farther down I have another select field that I'd like to filter based on base_position_id.
Obviously on first load, the logged value is empty. But when I select a base_position_id and the field refreshes, it still logs a blank value. Shouldn't I be getting the selected value at that point? I need it to add a filter to the return collection.
18 replies
Does configureUsing work on Filament\Panel?
I'm using a logo on my panel which works fine if I set it in the panel() method of the PanelProvider. But since i'm going to want the same on every panel, I'm trying to set them in a global Service Provider. To keep things separate, I created a new provider and added this:
I initially tried it without the isImportant but saw that mentioned elsewhere so I gave it a shot. No joy. I've also tried it in AppServiceProvider just to rule out any problems with the new one but same result.
I also added a log line at the top of the boot() method to verify that it's getting called and it is. Multiple times.
Any thoughts on why the config is not being picked up?
8 replies
Simple repeater data passing in as string instead of array
I'm being thrown for a loop by what I thought were pretty basic repeaters. I've got two simple repeaters in my form: functions & qualifications.
They look like this in the migration:
the form fields are defined as:
and I have casts in the model:
When I initially add the record - or if I manually set them to NULL and then edit it - I can add items to the repeater. What gets stored in the database is
including the surrounding quotes. But if I edit a record that has any data in the field(s), I get the following error:
I've been up and down the Repeater docs page numerous times and I'm not seeing anything that looks out of place. Am I missing something? Any idea what I'm doing wrong?
Thanks.
7 replies
How to get the value of sibling in an Infolist RepeatableEntry
I'm trying to customize the label and/or hide an field based on the value of another field in the repeater by passing in a closure. So, hide field2 if field1 == 'Foo'. What can I pass into the closure to get the value of field1?
2 replies
Wizard submitAction button doesn't do validation or submission
Using a wizard in a Livewire component. I can put a wire:submit on the form tag in the blade template for the component and that works as expected. But that means I have to have a separate set of validation for just the last step, right? And the form state ends up looking very different if I do $this->form->getState() in the Livewire component than it does between steps in the Form component.
So I guess the question is: Is this the expected behavior or am I doing something wrong?
3 replies
Radio button layout based on media breakpoint?
Is it possible to have ->inline() at larger screen sizes but not on small ones? The options wrap fine when things get too small but on some mobile screens you end up with some wrapping and some not. My gut and a quick look at the code says it can't be done but it never hurts to ask.
4 replies
requiredWithoutAll() validation being ignored
I'm using a Form Builder form in a regular Livewire component. Simple validations on the fields (required, email) work fine. But I have three fields with a requiredWithoutAll rule for the other two. So field1 has . These rules get ignored. No error messages and nothing in the logs. Just goes along and submits without any issue. I can put a secondary validation in the Livewire component itself which does catch them but it (a) makes for an ugly UX difference and (b) for some reason, custom error messages aren't working there. Any ideas why these rules aren't getting triggered?
4 replies
Custom EditProfile page not rendering the form
I'm building a jobs management and application site and I want to force the user to an Applicant Profile page before they can do anything else. This uses an Applicant model that's a relation to their User object. I have the form working as a regular Livewire component/view with a Filament form but I was getting some strange behavior with validation. So I'm trying to fit it into Filament's auth profile feature to see it that fixes it.
First, I know the custom EditProfile class is getting used. The properties/methods that I am overriding (heading and isSimple) are being used correctly. And in the form() function, I can dd and see the Form object that's being created and returned. But I'm not getting the form rendered on the page. Just a big blank space after the heading. Any ideas why?
Second, is this even a decent way to handle this? Is it assumed that EditProfile is using a User object? I currently have since I'm not actually going to change anything about the User object. Should I feed it the User instead and use the relationship for the applicant data? I'm really hoping to avoid going back to the standalone form and wrestling with the validation issues.
1 replies
Multiple authentication methods?
Is it possible to use different authentication methods for front end panel users vs. admin panel users? I need to allow normal user registration and login for the general public and authenticate our internal users against our SSO provider. This is my first Filament app and I've never done both even on a plain Laravel site. Is it possible or do I have to split this into two distinct apps?
On a related note, I have a basic solution for the SSO side in Laravel by changing where the Authenticate middleware points. But do I need to do anything specific to tell Filament to use that?
Am I really overthinking this? Or is the whole thing as simple as duplicating that middleware and having an admin version and a normie version?
4 replies