Hello, firstly I am brand new to Retool, so I feel perhaps I am not doing something basic, but I am struggling to fix this. Hope you can help.
I have created a form that can update data, (postgress DB) It shows the values I am interested in (in this case a customer record) If I want to update one field of five, the one value I enter updates fine, the other four (which I have left as original) then updates to the same value as before but with {""} for example {"Ben Waltern"}, if I update it again (no change made) it nests the value again!
I am not doing anything fancy or bespoke...that I am aware...
as you can see in the first screen shot its wrapping["name"]
(this is because I tried key value pair....if I use {{customerForm.Data}} it wraps {"name"}
on any field I dont edit!
OK so in the form itself, you are adding data from a query to each of the fields and then updating that data when you edit the form?
If so, two things:
the query that you are running should provide all of the information you need for most if not all f the form fields and so for each of them you should add as the Default value
something like {{customerForm.data.name}} but I don't know what the data looks like that you are using in the form and
If you could post a screenshot of the Inspect panel on the right where the Default value field is for "name" that would also help.
also what is the result of the QUERY (is the QUERY named "customerForm" or is it named "query1" or something like "getCustomer" populating the form, if any?
If so it should be {{getCustomer.data.first_name}}
The query it uses to populate is from another form, I have two "apps" search and update. The search simply find a specific record(s), select view on a specific record it then opens up the update "app" which is this form. The query is from the ID passed over in the URL from the search "app".
You can see from the screen shot below (although its hard coded here as I was just testing this specific record.)
"it then opens up the update "app" which is this form."
Ahh ok so to pass values from one app to another you are using url parameters...
if you are moving from one app to another and let's say the id is 157320 then your "update" form should be populated with a query in the same "update" app that is using that id parameter select * from customers where {{urlparams.hash.id}}
and let's for argument sake say that query is called getCustomerByID you would then populate the first name field with {{getCustomerByID.data.first_name}}