Custom JS in filament page

hello all , is there any way that I can insert javascript in my filament page? I want to use HTML geolocation and include the latitude and longitude in my form
12 Replies
LeandroFerreira
Hi,
<!-- Your component's view here -->

@push('scripts')
<script>
// Your JS here.
</script>
@endpush
<!-- Your component's view here -->

@push('scripts')
<script>
// Your JS here.
</script>
@endpush
or https://filamentphp.com/docs/2.x/admin/appearance#including-frontend-assets
Filament
Appearance - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.
Lambertn33
Lambertn33OP2y ago
@leandro_ferreira thank you so much for this
Lambertn33
Lambertn33OP2y ago
Lambertn33
Lambertn33OP2y ago
after trying to get the current location, I got in in console. now is there any way that I can put the latitude and longitude in my inputs?
wyChoong
wyChoong2y ago
Save yourself some time with #google-maps
Lambertn33
Lambertn33OP2y ago
thanks friend @wychoong Tables\Actions\Action::make('test') ->action(function () { ...... (can I link to a JS file here?) }),
Dennis Koch
Dennis Koch2y ago
What should a JS file inside a PHP method do?
Lambertn33
Lambertn33OP2y ago
@Dennis Koch I want to alert some information from the console and show thrm to the user! eg: html geolocation
Dennis Koch
Dennis Koch2y ago
You could send a Livewire event and handle that on the frontend. Check the Livewire docs for this.
Passenger
Passenger16mo ago
@push('scripts') seems to be broken in v3. Worked fine in v2..
Passenger
Passenger16mo ago
Yes, not as convenient, as i'd need to keep running php artisan filament:assets but that works. Thanks
Want results from more Discord servers?
Add your server