Linking a list to a 2nd table

empulse 20d ago

I have created a form that displays a list of records (rows) from a MySql table (i.e. Table-One).  I have created a second (edit) page that shows fields from Table-One (i.e. Name, phone, no. etc)  I want to add fields to the edit page that are not in Table-One  (notes, email address etc) to be saved to Table-Two but not to the original table (Table-One) .  There should be no changes, edits, deletions, etc to the rows in Table-One.  Table-Two should have references to the selected record (row) in Table-One.  Each time a user edits the record in Table-Two, the Joomla user ID should be saved.I know how to construct  SQL tables to do this, but I am flummoxed when trying to do this through the CF8 UI.

Can you provide some guidance?

(Joomla 6, Chronoforms 8)

Max_admin 18d ago
Answer

The edit page Submit will have 2 Save Data actions, one saving to table 1 and another to table 2, in the Modify Data Source of Save Data #2 you need to set the foreign key value using {var:save_data_1.id} assuming your table 1 primary key is named "id":

id={var:save_data_1.id} // change save_data_1 to the name of your save data to 1st table
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Post a Reply