Getting a form application with pre-filled data

Hello Retool team,

I am having a trouble while build an application that is a form which has a lot of input fields. When the end user fill the data and click a "Save" button, it perfectly save to the db. But my problem is getting previous data back in the application.

I need to create a new unique(it might be the primary key in the db) URL for each generation of the application, and use this link afterwards to get the application with pre-filled data which are related to this unique URL (or primary key in the db).

Currently, I can get a URL with a unique ID. When I clicked this URL, I got the application form with a field with this unique ID value. I added event handlers to set other fields values from the database. But, I need to press 'Enter' key to trigger set.value() event handlers for the empty fields. I need to trigger event handlers with any input changes, without clicking a button or pressing 'Enter' key.

You can see the screenshots of an example empty form and pre-filled form below:
This is an example of an empty form.

When I click the unique URL, I need to get this kind of a form:

If you can help me, I will be really appreciate!
Thank you!

Hey @SelinAydoner,

Let's see. Looks like you just need a query that fetches the info from your DB based on the urlparams -> id you're setting in the URL.

So for example.com?id=1 would expose urlparams.id to your app. Then, your query would look something like this:

SELECT
  *
FROM
  something
WHERE
  id = {{urlparams.id}}

Be sure to disable the query if the param is not present.

Then on each input you can set the default value to the variables returned from the query, something like {{query.data?.user}} and so on.

Is that what you're looking for?