Load fields from DB, allow edit, validate and save back

bcraigie 29 May, 2024

Please can someone explain how I get the data from a database load into the fields of a form in V8?  I have a lot of V5 forms to convert to V8, so just learning the differences.  I want to create a form like this (truncated for this example):

Load fields from DB, allow edit, validate and save back image 1

Load fields from DB, allow edit, validate and save back image 2

I can see with the Debug turned on that the field price_raffle_tickets exists in the loaded data.  But the value does not get to the form.

I think I'm missing something simple, possibly in the Field Name?

I want to ensure that if the user changes the value in the field that it will get written back to the database.  How do I make that link?

Thanks :-)

bcraigie 30 May, 2024

I found the answer.  I dragged the Container out of the "On record(s) found" block to below it.  Strange as it was the logical place for it to be.  I only wanted to show the container if the record was found.

I now don't know how to handle the record not being found (ie what do I put in the "On no records found" block so that it doesn't just carry on anyway.  If anyone knows, I'd be grateful for an explanation, and if I figure it out myself, I'll post it here for others. :-)

bcraigie 31 May, 2024
Answer
1 Likes

I've now come to try and save the data back.  I want to update the record I just read with the updated data from the form.  In the Submit section in a Save Data block, I've specified a where clause like this:

`id`={data.quote:id}

What I want it to do is update the table with the new values where the id column in the table = the id of the read record (which is 1 in this case).

But I get :

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE `id`='1'' at line 1

I've now figured this out too.  I found this help page which I somehow didn't see before.  All I had to do was add {data:} into the Data Source box.

:-)

Brian

P.S. the back ticks are correctly placed before and after id, but the forum has moved them in the display.  Strange.

darkarturo 15 Jun, 2024
Hello bcraigie, please is there a way to contact you, I also need help please, since I want to do the same as you.. please
You need to login to be able to post a reply.