CFv4 Working with the database

How can I add a new column to a database table or change a column type?

ChronoForms v4 has a tool to Create new database tables, but does not include a table editor to change existing tables. Here are some suggestions to help with that:

How can I edit a record from a database table?

If you have saved form data to a database table you often want to be able to re-load it into a form for editing. This FAQ tells you how to load a record using the DB Record Loader action.

How can I edit my database table and debug queries?

ChronoForms provides a simple tool for creating database tables and a basic data viewer but I often find that I need to be able to edit the table to add or alter columns; to test MySQL queries; or to view some of the data to check exactly what is being saved. This FAQ suggests some tools to help with that.

How can I edit the record for an image?

When a form includes an image ChronoForms will save the image name in a database table. This allows the image to be recovered and displayed as needed but it can be difficult to edit the record if changes are needed. When you re-display the record in an edit form the file upload input is not filled in; and if the user submits the form with the file upload empty the existing image name can be over-written with a empty name.

How can I set the order in the Data Displayer?

The ChronoForms DB Multi-Record Loader action has a built in data displayer tab that creates a neat table for the records selected. This FAQ shows you how to set the order of the records listed.

How can I connect to another database?

This FAQ tells you how to connect to a database other than the default site database.

How can I link two DB Multi Record Loaders?

The ChronoForms DB Multi-Record Loader action is a very flexible tool. It allows you to extract data from tables in the database to use in your form or form submission; or to display with your form. A single DB Multi Record Loader can only access one table though and sometimes we need to get linked data from more than one table; for example, we might look up a list of Joomla articles and then want to show the author's name with the article. The #__content table has the author's User ID but not the name, that is in the #__users table.

How do I save form data to a database table?

Here's a short video tutorial to show you how to add a DB Save action to your form.

How can I select 'types' in a database table?

When you use the Create Table icon in the Forms Manager toolbar you can specify the 'type' for each column in the database table. For many tables the defaults will work OK but sometimes you need to be more specific. Here are some notes on selecting column types.

How to create a table for my form

If you need to store your form results in a database table you'll need to create a suitable table. ChronoForms has a quick way to do that.

My form data isn't saving to the database correctly

ChronoForms will automatically save data to a database table if you have added a DB Save action (or actions) to the form On Submit event. Here is a useful checklist: