Update: This tutorial uses the 7.x-1.x version of Entityforms. The notification and validation settings have changed in 7.x-2.x, which is the stable version.
Entityforms module allows site builders to create survey style front-end forms without having to write any custom code. The form results are stored in the database and can be exported out. The module is integrated with Rules (What’s Rules?) which gives developers a lot of flexibility.
Entityforms is very similar to Webform, however Entityforms utilises Drupal’s Field API whereas Webform uses its own field system. By leveraging Drupal’s Field API, you can use any module that implements its own field like Link, Date, Email and many more. Also, the user interface for adding fields to an Entityforms form is the same as adding fields to a node, you will not have to learn a new user interface.
In this tutorial, we’ll use Entityforms to create a fake complaints form.
Setting up Entityforms is fairly simple, however you’ll have to download a few dependencies before you can install the module.
Before we begin, download and install the modules below.
You’ll also need to download the Email Field module if you’re following along with this tutorial as we’ll use this field on the form.
If you use Drush, run the following command:
drush dl entityform entity rules views ctools email variable_email variable
Create a Form
Now that we have everything setup and ready to go, let’s create our complaints form. The form will be fairly simple it’ll have a name, email, message and department field.
1. Go to Structure -> “Entityform Types” and click on “Add entityform type”.
2. Enter “Complaints” into the name field.
3. Scroll down to the “Access settings” vertical tab and check the “authenticated user” checkbox within Roles. Once complete, click on “Save entityform type”.
Note: The form will only be accessible for authenticated users.
Attach Fields to Form
At this point we have just created the form, now we need to attach fields to the form. We’ll create four fields, name (text field), email (email field), message (long text field) and department (select field). Also, make sure all the fields are mandatory.
1. Create a Name field using the settings defined in Table 1-0.
Table 1-0. Define a Name field
2. Create an Email field using the settings defined in Table 1-1.
Table 1-1. Define an Email field
3. Create a Department field using the settings defined in Table 1-2.
Table 1-2. Define a Department field
|Field type||List (text)|
Copy and paste the text below into the “Allowed values list” text area when you configure this field.
Accounts|Accounts Marketing|Marketing Information|Information
4. Create a Message field using the settings defined in Table 1-3.
Table 1-3. Define a Message field
|Field type||Long text|
|Widget||Text area (multiple rows)|
Once all the fields have been created, the “Manage fields” page should look like the image below.
At this point, we have a working form. If you need to find the form URL, go to Structure -> “Entityform Types” (admin/structure/entityform_types) and click on “Submit Link”.
Form in Action
Login with a user account and go to the Complaints form at
eform/submit/complaints and submit the form to make sure everything works.
Form submissions can be viewed by clicking on “Submissions” from the “Entityform Types” (admin/structure/entityform_types) page.
The final piece of functionality that we’ll look at in this tutorial is how to setup email notifications. Entityforms ships with a sub-module called “Entityforms Notifications”. If you haven’t already, go and enable this module.
Once you enable “Entityforms Notifications”, you’ll get an extra vertical tab option when you edit a form.
1. Go to Structure -> “Entityform Types” (admin/structure/entityform_types) and click on “edit” within the Complaints row.
2. Click on the “Notifications settings” vertical tab.
3. Select the “Email Entityform Admin” and “Email Entityform Submitter” option from the “Submission rules” field.
4. Enter in the confirmation email text into “Email text.”
5. Enter in email addresses into the “Notification emails” field.
Now if we submit a form, the submitter as well as any emails in the “Notification emails” should receive an email.
In part 2 of this series, we’ll look further into access and submission rules.
If you have any questions, please leave a comment.