Register Page with parameters

Hi to everybody. I have a problem with my register page. I changed the register page: now they have to fill some data and then they can enter. Everything is working well and smooth. My problem is that I would like to call the register page http://winetour4.test/guest/register adding some url parameters like http://winetour4.test/guest/register?exhibit=vietnam so I can prefill a SELECT with the right option like in the attached image. I really have no idea how to do it.
No description
3 Replies
toeknee
toeknee4d ago
Is this a custom page? Just use
public function mount() {

$this->form->fill([
'email' => $request->query('email'),
'name' => $request->query('name')
]);
}
public function mount() {

$this->form->fill([
'email' => $request->query('email'),
'name' => $request->query('name')
]);
}
ziolupo
ziolupoOP4d ago
I'm inheriting from Register:
class Registration extends BaseRegister
{
protected ?string $maxWidth = '3xl';
public function form(Form $form): Form
[...]
class Registration extends BaseRegister
{
protected ?string $maxWidth = '3xl';
public function form(Form $form): Form
[...]
but your idea bring me to the right path and now is working:
protected function getExhibitionFormComponent(): Component
{
return Select::make('exhibition_id')
->label(fn() => new HtmlString('Select the <em>exhibition</em> you want to attend'))
->default(request('exhib'))
->preload()
->native(false)
->searchable()
->required()
// ->autofocus()
->options(Exhibition::where('active',true)->pluck('name', 'id'));
}
protected function getExhibitionFormComponent(): Component
{
return Select::make('exhibition_id')
->label(fn() => new HtmlString('Select the <em>exhibition</em> you want to attend'))
->default(request('exhib'))
->preload()
->native(false)
->searchable()
->required()
// ->autofocus()
->options(Exhibition::where('active',true)->pluck('name', 'id'));
}
Thank you!
Mohamed Ayaou
Mohamed Ayaou4d ago
Always remeber that every filament page is just a Livewire component

Did you find this page helpful?