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.
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.
Sign up to join this communityIs 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.
Yes, but it would require some knowledge about MySQL and your form fields. Steps below:
EE CP > Add-Ons > Modules > Freeform Pro
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.expression_engine
, so I would type use expression_engine
at the command line.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
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!