How to automatically call form submit action after the form is rendered?
I have a form that I initialize with some props. I need to call the submit method once the form is rendered. I was thinking about lifecycle hooks. Any help?
5 Replies
can you explain why you want to do that?
I have a hidden text that sends to ChatGPT API as a prompt. So when user open up this form it should trigger the submit action and then should fill form fields according to response
i dont think submitting the form is the best way to go about it
are you using the admin panel or just the form builder
admin panel
You should do this in a life cycle hook. https://filamentphp.com/docs/2.x/admin/resources/creating-records#lifecycle-hooks
Filament
Creating records - Resources - Admin Panel - Filament
The elegant TALL stack admin panel for Laravel artisans.