Showing a form
<x-render-form :form="$form" /> shows a form on a page, with its conditional
fields, its steps and its spam traps working; it loads the script and
stylesheet they need once per page, see
Styling forms on the site. Given null, it shows
nothing. An editor picks the form, for instance in a page block, with
FormSelect:
use VanOns\FilamentFormBuilder\Filament\Forms\Components\FormSelect;
FormSelect::make('form_id')->required()Every form renders through the components/form view. Pass another for one
form with <x-render-form :form="$form" view="forms.vacancy" />, or publish
the views with php artisan vendor:publish --tag=filament-form-builder-views
and keep only the files you change.
The form posts to /filament-form-builder/{id}/submit, the route
filament-form-builder.form.store, through the middleware in
form_middleware: web by default. Add what the site's own pages run through
and the submission needs too, such as the middleware that sets the language,
which the validation messages follow. The visitor then sees the thank-you
message on the same page or goes to the form's redirect, see
Submit notification; both come as a 303 redirect, which
the browser follows. A front end in React or Vue posts to the same route, see
In a front end of your own.
A visitor whose session expired while the form was open comes back to the form
instead of a 419 page: the answers are still there, files have to be chosen
again, and a message above the form says it was not sent. A components/form
view of your own shows that message where
session('filament_form_builder_expired') is the form's id. A request that
asks for JSON keeps its 419. From Laravel 13 a browser that tells the server
the request comes from the site itself gets through without a token, so the
message mostly shows on Laravel 12 and in older browsers.
