Passing an id in query params - and setting it to default in select

A am passing an id in query params - and setting it to default in select - is it possible? I am looking for a way to have the id instead of the “select and option”. Any ideas :)?

2 Likes

Hey @Ana ,

I totally get what you’re running into — I had a similar case in my app where I needed to set a default value in a Select component using a value passed through URL query parameters.

Here’s how I handled it
I set the default value like this:

{{Number(url.searchParams.id) }}

Just make sure that your Select component’s value field actually stores the ID (not the label or name). Otherwise, the default won’t match properly.

Here’s a quick example screenshot for reference:

This approach works perfectly when you want to preselect an option dynamically based on a URL parameter — super handy for things like detail pages, edit forms, or filtered views.

Hope that helps! Let me know if you want more things.

2 Likes