CF7- Auto populate form fields with database read

mayergreenberg259 26 Nov, 2023
I am using chronoforms 7.
I would like to do a database read which returns 1 row.
I would then like the fields to automatically appear in a form on the page.
I know I can do this manually by setting the value of each field in the form with the {var:Payments.PaymentId} tag (Payments is the model name and PaymentId is a column name).
But is there a way to do this automatically? The read data action has a 'Populate Fields' behavior. What does it do? How do I use it?

Thank you.
mayergreenberg259 26 Nov, 2023
Never mind. The answer is to make the field name into the name of the model with the column name. Payments.PaymentId in my case.
darkarturo 31 Oct, 2024

If you managed to do that to recover the data in a form, could you make a tutorial or something please?

mayergreenberg259 31 Oct, 2024
Answer
1 Likes

I'd prefer not to make a video of myself doing it, that would be too much effort.

But I can explain what I did.

In the Actions section of Chronoforms 7, you use a read data to retrieve one row from a database table. In the Behaviors section of the read data I set the it to populate fields and set models data.Then in the Views section I made a form and made the forms inputs have names that come from the database table. For example if I have a Person table with columns for Age, Height, and Weight, I would make the field name of the HTML form inputs (within chronoforms) Person.Age, Person.Height, Person.Height.

Is there anything else that I can explain?

Max_admin 01 Nov, 2024

in v8 you just need to have a "Read data" with Merge Data behavior enabled and your form fields names should match the table columns names

Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.

VPS & Email Hosting 20% discount
hostinger