2

Is there a way to import to Freeform Forms? I wanted to create a form with pre-filled information, and users can login and use freeform edit their existing entries?

Thanks and I appreciate your feedback.

2

1 Answer 1

1

Yes, but it would require some knowledge about MySQL and your form fields. Steps below:

  1. Create your form in EE CP > Add-Ons > Modules > Freeform Pro
  2. Note the newly created Freeform form_id (open the form page and look at your URL - you will see in the GET request the &form_id=XX where XX is an integer.
  3. Open MySQL from the command line
  4. Select your database. My EE db is called expression_engine, so I would type use expression_engine at the command line.
  5. If you type show tables you will see all your EE database tables. Your Freeform form will have the table name exp_freeform_form_entries_XX where XX is your form_id
  6. Take a look at the Freeform form table schema by typing describe exp_freeform_form_entries_XX. You will see all the fields and their types. An example below:
mysql> describe exp_freeform_form_entries_1;
+--------------+------------------+------+-----+---------+----------------+
| Field        | Type             | Null | Key | Default | Extra          |
+--------------+------------------+------+-----+---------+----------------+
| entry_id     | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| site_id      | int(10) unsigned | NO   |     | 1       |                |
| author_id    | int(10) unsigned | NO   |     | 0       |                |
| complete     | varchar(1)       | NO   |     | y       |                |
| ip_address   | varchar(40)      | NO   |     | 0       |                |
| entry_date   | int(10) unsigned | NO   |     | 0       |                |
| edit_date    | int(10) unsigned | NO   |     | 0       |                |
| status       | varchar(50)      | YES  |     | NULL    |                |
| form_field_1 | text             | YES  |     | NULL    |                |
| form_field_2 | text             | YES  |     | NULL    |                |
| form_field_3 | text             | YES  |     | NULL    |                |
| form_field_4 | text             | YES  |     | NULL    |                |
+--------------+------------------+------+-----+---------+----------------+
12 rows in set (0.00 sec)

The author_id field is your EE member/user primary key (the member_id in the exp_members database table). The form_field_X fields are your custom form fields created in Freeform. Be careful to match them up correctly! You should make sure the entry_date field is filled out with a valid UNIX timestamp.

Now you have all the critical fields ids you need to write a simple PHP or shell script that would run a sequence of MySQL INSERT statements to add your pre-filled information to the form.

I hope that helps, and good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.