How to save form data to a custom database table using Sava Data action

Discover how to save your Joomla form data to any database table using ChronoForms8, and easily control the data to be saved.

if saving the form data in the forms log is not enough for your needs, you can use the Save Data action to save the form data to a custom database table, this table may already be in your database or you may create it using a database administration tool like PHPMyAdmin or ChronoMyAdmin

Let's add the Sava Data to our form first:

  1. Open the Actions area on the right side panel
  2. Expand the Database group
  3. Drag the Sava Data action to your form and open the action settings

How to save form data to a custom database table using Sava Data action image 2

Now we need to choose which data to be saved, this requires mapping a list of data to our table columns, there are 2 ways to do this, choosing one depends on your scenario

The first way to setup the main data source and select which fields to be used out of this data source:

  1. In the Data Source field add {data:}, this will return the whole data array submitted by the form, this can be changed to something else if you need to save a different data set.
  2. if the data source set in step 1 has extra unnecessary fields, we can select which fields to be stored by enabling the Table Fields behavior
  3. Enter a list of table columns to be selected from the broad data source.

How to save form data to a custom database table using Sava Data action image 3

The 2nd way to provide data to the Save Data action is using the Modify Data Source behavior which lets you map any data to each column in your table:

  1. Enable the Modify Data Source behavior
  2. Add each table column name you want to save followed by an equal sign followed by a value to be saved, the value can a ChronoForms shortcode, few of them are shown in the image

How to save form data to a custom database table using Sava Data action image 4

Category: ChronoForms v8

Comments:

You need to login to be able to post a comment.