V4 Save form in livewire component

Hi, working on custom plugin for Filamentphp V4 I've worked without problem in the past with the V3 but this time i'm making a plugin that add a register/login form outside the panels The plugin is registerd in the AdminPanel. Livewire component
public function registerSchema(Schema $schema): Schema
{
return $schema
->schema([
Section::make('Informazioni Tenant')
->schema([
TextInput::make('tenant_name')
->label('Nome Tenant')
->required()
->placeholder('Nome del tuo tenant'),

TextInput::make('tenant_domain')
->label('Dominio')
->required()
->placeholder('mio-tenant'),

TextInput::make('tenant_database')
->label('Database')
->required()
->placeholder('tenant_mio_tenant'),
])
->columns(1),

Section::make('Informazioni Utente Admin')
->schema([
TextInput::make('user_name')
->label('Nome Utente')
->required()
->placeholder('Il tuo nome'),

TextInput::make('user_email')
->label('Email')
->email()
->required()
->placeholder('admin@example.com'),

TextInput::make('user_password')
->label('Password')
->password()
->required()
->placeholder('Password sicura'),
])
->columns(1),
]);
}
public function registerSchema(Schema $schema): Schema
{
return $schema
->schema([
Section::make('Informazioni Tenant')
->schema([
TextInput::make('tenant_name')
->label('Nome Tenant')
->required()
->placeholder('Nome del tuo tenant'),

TextInput::make('tenant_domain')
->label('Dominio')
->required()
->placeholder('mio-tenant'),

TextInput::make('tenant_database')
->label('Database')
->required()
->placeholder('tenant_mio_tenant'),
])
->columns(1),

Section::make('Informazioni Utente Admin')
->schema([
TextInput::make('user_name')
->label('Nome Utente')
->required()
->placeholder('Il tuo nome'),

TextInput::make('user_email')
->label('Email')
->email()
->required()
->placeholder('admin@example.com'),

TextInput::make('user_password')
->label('Password')
->password()
->required()
->placeholder('Password sicura'),
])
->columns(1),
]);
}
6 Replies
Soundmit
SoundmitOP3mo ago
when i submit the form, the create function is called but $this->registerSchema->getState(); us empty
public function create(): void
{
logger('Create method called');
$data = $this->registerSchema->getState();
logger('Form data: ' . json_encode($data));
public function create(): void
{
logger('Create method called');
$data = $this->registerSchema->getState();
logger('Form data: ' . json_encode($data));
Bonus question: Style Finally i'm able to load tailwind4 and compile for the component some style are applied (confirm that works) but the form is completely unstyled
frame
frame3mo ago
maybe first verify that styles work when custom theme is disabled, then recheck the necessary tailwind changes on the custom theme are done and successfully built
frame
frame3mo ago
also there's a bug with some styles not currently working https://github.com/filamentphp/filament/issues/16257
GitHub
v4 Some styles don't render properly when Vite dev server is runnin...
Package filament/filament Package Version 4-alpha6 Laravel Version 12 Livewire Version 3 PHP Version 8.4 Problem description Some button styles aren't rendering properly when using the Vite dev...
Soundmit
SoundmitOP3mo ago
I've created a custom admin theme and compiled everything — the final CSS is around 500KB, which seems a bit heavy? By the way, my plugin is currently front-end only. I assume custom themes are meant for the Filament admin panel, right? The CSS for the public pages is included in the plugin and loads correctly, but it doesn't seem to style the form inputs. Inspecting the HTML, I see something like this:
<div class="fi-input-wrp-content-ctn">
<input class="fi-input" id="registerSchema.informazioni-tenant::section.tenant_database" placeholder="tenant_mio_tenant" required="required" type="text" wire:model="tenant_database">
</div>
<div class="fi-input-wrp-content-ctn">
<input class="fi-input" id="registerSchema.informazioni-tenant::section.tenant_database" placeholder="tenant_mio_tenant" required="required" type="text" wire:model="tenant_database">
</div>
The input has the fi-input class but no Tailwind classes — is that expected? Should I manually style those in the public-facing plugin?
No description
Soundmit
SoundmitOP3mo ago
regarding the empty form, i get No property found for validation: [tenant_name] i've added this to every field, but did not solve ->validatedWhenNotDehydrated(false) my mount function is
public function mount(): void
{
$this->registerSchema->fill();
logger('RegisterTenant component mounted');
}
public function mount(): void
{
$this->registerSchema->fill();
logger('RegisterTenant component mounted');
}
local.DEBUG: RegisterTenant component mounted ok, solved the functional part
public function mount(): void
{
// Inizializza lo schema con dati vuoti
$this->form->fill();
logger('RegisterTenant component mounted');
}



public function form(Schema $schema): Schema
{
return $schema
->components([

TextInput::make('tenant_name')
->label('Nome Tenant')
->required()
->placeholder('Nome del tuo tenant'),

TextInput::make('tenant_domain')
->label('Dominio')
->required()
->placeholder('mio-tenant'),

TextInput::make('tenant_database')
->label('Database')
->required()
->placeholder('tenant_mio_tenant'),
TextInput::make('user_name')
->label('Nome Utente')
->required()
->placeholder('Il tuo nome'),

TextInput::make('user_email')
->label('Email')
->email()
->required()
->placeholder('admin@example.com'),

TextInput::make('user_password')
->label('Password')
->password()
->required()
->placeholder('Password sicura'),
])->statePath('data');
}

public function create(): void
{
logger('Create method called');
$data = $this->form->getState();
logger('Schema data: ' . json_encode($data));
public function mount(): void
{
// Inizializza lo schema con dati vuoti
$this->form->fill();
logger('RegisterTenant component mounted');
}



public function form(Schema $schema): Schema
{
return $schema
->components([

TextInput::make('tenant_name')
->label('Nome Tenant')
->required()
->placeholder('Nome del tuo tenant'),

TextInput::make('tenant_domain')
->label('Dominio')
->required()
->placeholder('mio-tenant'),

TextInput::make('tenant_database')
->label('Database')
->required()
->placeholder('tenant_mio_tenant'),
TextInput::make('user_name')
->label('Nome Utente')
->required()
->placeholder('Il tuo nome'),

TextInput::make('user_email')
->label('Email')
->email()
->required()
->placeholder('admin@example.com'),

TextInput::make('user_password')
->label('Password')
->password()
->required()
->placeholder('Password sicura'),
])->statePath('data');
}

public function create(): void
{
logger('Create method called');
$data = $this->form->getState();
logger('Schema data: ' . json_encode($data));
now i need to style the form
Soundmit
SoundmitOP3mo ago
done with custom css
No description

Did you find this page helpful?