Read and write data from MySQL

Twickbot 02 Jun, 2017
I create form with two text fields and one button "Save".

I want to do:
1. When form is opened fill this two text fields with text from two сorresponding fields of MySQL's table.
2. When I change text in this form's fields and press button "Save" new text must be written in MySQL.

Is it possible with CC6?

Thank you in advance for any help.
surendersingh 02 Jun, 2017
Yes it is possible by action Read Data and Save Data Action in Setup tab.
Twickbot 02 Jun, 2017
Thank you for answer.
I try to read "Chronoforms start guide" and "FAQs" but didn't find info about how to realease my task.
Can u explane me what should I do step by step?
Or where can I read about it?
Twickbot 02 Jun, 2017
Ok.
1. In Designer I created page with two text fields.
2. In Setup I created Read Data for read data from MySQL.
In Debug section I see that data was read correct from DB.

What should I write in Text Field's value to show data retrieved from MySQL?

Didn't find any info. 😟
Max_admin 04 Jun, 2017
Answer
Hi Twickbot,

The read data should be above the "display section", and most probably you want to read one record only and so the read data should be configured to read the first matching record.

Now you can use this in the "Value" setting of your field:

{var:read_data_name.Model.table_field}


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Twickbot 10 Jun, 2017
Many thanks!
It worked!

One more question:
I change the value in this field.

What should I prescribe in the settings of the "Save" button so that the new value will save in the database?
Max_admin 11 Jun, 2017
Hi Twickbot,

How do you have the "Save data" action configured ?

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Twickbot 11 Jun, 2017
Not yet configured.
What I must to write in "Value" field?
Max_admin 11 Jun, 2017
The Save data action will save the form data assuming that a table is selected and the "data provider" is set to {data:} and that the table fields names match the form fields names.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Twickbot 12 Jun, 2017
In "Setup" => "submit" tab I added "Save Data" then:

- "Model name" - write name.
- "Database table" - select table.
- "Data provider" - {data:}.
- "Write action" - Update
- "Update conditions" - cms_id:{user:id}

But when I change data and press "Save" button on page data is not written to the database.

What am I doing wrong?
Twickbot 13 Jun, 2017
Ок.
By trial and error, I learned how to write data to the database.
Thanks for the help.
This topic is locked and no more replies can be posted.