Ngannv
Ngannv
FFilament
Created by SLy on 1/9/2024 in #❓┊help
How can I get current active form tab in a EditResource page?
I was also struggling and had to use the method below. It seems a bit manual, but hopefully it helps you First: in form:
Forms\Components\Tabs::make("vhelperTab")
->tabs([
Forms\Components\Tabs\Tab::make("tab1")
->id('tab1')
->schema(......),
Forms\Components\Tabs\Tab::make("tab2")
->id('tab2')
->schema(......),
])->activeTab($this->providerTabSelected)
->id('xxx')
->persistTabInQueryString('provider'); //important
Forms\Components\Tabs::make("vhelperTab")
->tabs([
Forms\Components\Tabs\Tab::make("tab1")
->id('tab1')
->schema(......),
Forms\Components\Tabs\Tab::make("tab2")
->id('tab2')
->schema(......),
])->activeTab($this->providerTabSelected)
->id('xxx')
->persistTabInQueryString('provider'); //important
Then define function :
public function getActiveTabVHelper($url): void
{
$queryString = parse_url($url)['query'] ?? null;
parse_str($queryString??'', $queryParams);
//auto with number
$this->providerTabSelected = (int)preg_replace('/[^0-9]/', '', $queryParams['provider']);
//or switch...
switch ($queryParams['provider']){
case 'xxx-tab1-tab':{
$this->providerTabSelected = 1;
break;
}
case 'xxx-tab2-tab':{
$this->providerTabSelected = 2;
break;
}
}
}
public function getActiveTabVHelper($url): void
{
$queryString = parse_url($url)['query'] ?? null;
parse_str($queryString??'', $queryParams);
//auto with number
$this->providerTabSelected = (int)preg_replace('/[^0-9]/', '', $queryParams['provider']);
//or switch...
switch ($queryParams['provider']){
case 'xxx-tab1-tab':{
$this->providerTabSelected = 1;
break;
}
case 'xxx-tab2-tab':{
$this->providerTabSelected = 2;
break;
}
}
}
Then: in mount or in submit function call getActiveTabVHelper
public function mount(): void
{

$this->getActiveTabVHelper(request()->fullUrl());
}

public function onSubmitOrFunctionCallByAjaxLiveWire(){
$this->getActiveTabVHelper(request()->server('HTTP_REFERER'));
....
}
public function mount(): void
{

$this->getActiveTabVHelper(request()->fullUrl());
}

public function onSubmitOrFunctionCallByAjaxLiveWire(){
$this->getActiveTabVHelper(request()->server('HTTP_REFERER'));
....
}
Document: https://filamentphp.com/docs/3.x/forms/layout/tabs#persisting-the-current-tab-in-the-urls-query-string
4 replies
FFilament
Created by Azade on 12/31/2023 in #❓┊help
when I upload a .txt file in filament it changes to .csv !!!
3 replies
FFilament
Created by Bagus A on 12/29/2023 in #❓┊help
Show Image in InfoList
Sorry! please try this: TextEntry::make('anything')->formatStateUsing(function(){ return new HtmlString("<img src='https://codezi.pro/assets/logo-v6.png'>"); })->hiddenLabel(),
8 replies
FFilament
Created by Bagus A on 12/29/2023 in #❓┊help
Show Image in InfoList
You can: ViewEntry::make('status') ->view('blade file',$params) Or Placeholder::make('image')->hiddenLabel() ->content(new HtmlString('<img class="shadow-lg mx-auto rounded-md" src="' . $YOUR_URL. '">')),
8 replies
FFilament
Created by jals65 on 12/21/2023 in #❓┊help
Livewire actions on form component layout
It's ok if you switch to using Event. protected function setUp(): void { parent::setUp(); $this->registerListeners([ 'ProgressBarSection::addBar' => [ function ($component, $customValue) { // Your code here Notification::make()->title("You just called ProgressBarSection::addBar ")->send(); }, ], ]); $this->columnSpan('full'); } Blade view: <div> <button type="button" wire:click="dispatchFormEvent('ProgressBarSection::addBar', '{{ $getStatePath() }}', 'extra value')" >Click test demo Event </button> </div>
11 replies
FFilament
Created by jals65 on 12/21/2023 in #❓┊help
Livewire actions on form component layout
Can you share your code?
11 replies
FFilament
Created by Ngannv on 12/26/2023 in #❓┊help
How to get active tab in submit form
How to use $getActiveTab()?
6 replies
FFilament
Created by jals65 on 12/21/2023 in #❓┊help
Livewire actions on form component layout
11 replies
FFilament
Created by waleedGRT on 12/25/2023 in #❓┊help
Call action method from livewire
5 replies
FFilament
Created by jeph on 12/18/2023 in #❓┊help
Validation didn't work
No description
9 replies
FFilament
Created by jeph on 12/18/2023 in #❓┊help
Validation didn't work
This is my concept Php Filament CustomPage https://vhelper.pro/share/Zvt639wM4 And View: <x-filament-panels::page> <x-filament-panels::form autocomplete="off" wire:submit="submit"> {{ $this->form }} </x-filament-panels::form> </x-filament-panels::page>
9 replies
FFilament
Created by keyduc on 12/14/2023 in #❓┊help
Can I disable light mode theme?
No description
4 replies
FFilament
Created by jeph on 12/18/2023 in #❓┊help
Validation didn't work
if you used custom view you need call validate method public function submit(): void { //Custom view needd call this method $this->form->validate();

$input = $this->data; ..... }
9 replies
FFilament
Created by Ngannv on 12/17/2023 in #❓┊help
How to set Height or Max height for RickEditor?
Thanks so much!
5 replies