Multiple Categories with the Drupal Contact Module

tutuploadstutuploadsStep_1._Make_sure_the_Contact_module_is_enabled.png

The Drupal Contact module is often replaced by the Webform module. However, it can be useful in some situations. For example, imagine that you have different departments and you want each of them to get a different contact form on your Drupal website. If you’re willing to keep it simple, you can do everything you need with the core Contact module and won’t have to install anything else.

It all depends on knowing how to create categories and blocks.

Step 1. Make sure the Contact module is enabled

tutuploadstutuploadsStep_1._Make_sure_the_Contact_module_is_enabled.png
  1. Click Modules
  2. Click Save configuration.
  3. Click Configure next to Contact.

Step 2. Add and edit categories.

tutuploadstutuploadsStep_2._Add_and_edit_categories..png

Click Add category to add a new one.

There is a default category called Website feedback that you can use as well, but we are showing you how to add extra ones. You can edit the default category later if you need to.

Step 3. Configure the category

tutuploadstutuploadsStep_3._Configure_the_category..png
  1. Give the category a name.
  2. Specify the Recipients
  3. Create an Auto-reply message.
  4. Set Selected. Yes means it will be the default contact form. Since this is a new category, you probably want this to be No. You can only have one default.*
  5. Be sure to click the Save button.

*Selected: When a visitor clicks on the link to the contact form, the categories will show in a drop down list. Whichever one is chosen with a “Yes” will show automatically If you want your visitor to be forced to choose a category before submitting the form, make all of these fields “No”

Continue repeating the process until you have all the categories you want. A “category” can be a different department, a group or individual.

Step 4. Enable the menu link

tutuploadstutuploadsStep_4._Enable_the_menu_link..png

Jump to the Menus administration page by clicking the blue link in the instruction paragraph. Alternatively you can get their via the admin menu and clicking Structure then Menus.

tutuploadstutuploadsAlternate_path_to_Menus.png

Step 5. List the links

tutuploadstutuploadsStep5._List_the_links.png

A Contact menu item (disabled by default) is added to the Navigation menu, which you can modify on the Menus administration page. Click list links next to Navigation. 

Step 6. Enable the link

tutuploadstutuploadsStep_6._Enable_the_link.png

This menu link will go directly to the site-wide contact form. You will see a Contact menu item that is disabled. You can use this one as a guide for creating other menu links.

Step 7. Configure the link

tutuploadstutuploadsStep_7._Configure_the_link.png
  1. Edit the link title if needed.
  2. Enable the link so it appears on the menu.
  3. Choose the parent link if you want it to be different from the default “Navigation”.

Step 8. Add a block with instructions for the user

tutuploadstutuploadsStep_8._Add_a_block_with_instructions_for_the_user.png

Go to Structure > Blocks.

Step 9. Add a block

tutuploadstutuploadsStep_9._Add_a_block..png

Step 10. Add the block information

tutuploadstutuploadsStep_10._Add_the_block_information..png
  1. Enter a Block Description. This will not be seen by the public.
  2. Enter a Block Title. This will be seen by the public.
  3. Write your instructions. This will also be visible to the public,

Scroll down the page.

Step 11. Set the visibility settings by assigning it to the Contacts page

tutuploadstutuploadsStep_11._Set_the_visibility_settings_by_assigning_it_to_t.png
  1. Choose “Only listed pages”. The only page we want to have these instructions is the Contact page.
  2. Write “contact” in the text field.
  3. Save the block.

Specify pages by using their paths. Enter one path per line. The ‘*’ character is a wild card. Example paths are blog for the blog page and blog/* for every personal blog. is the front page.

There are other parameters and settings on this page, but for the purpose of this tutorial we only need the basics.

Step 12. Enable the block

tutuploadstutuploadsStep_12._Enable_the_block.png

You will be returned to the Blocks page. You will find the block you added in the Disabled list with the title you created. To enable it, choose the position from the drop down box.

tutuploadstutuploadsmedia_1318376672850.png

Choose Help.

This box lists all of the regions available on the template you are using. On the Bartik template, the Help region is right where we want it. You may have a different idea or location on your website.

Step 13. Final configuration then save.

tutuploadstutuploadsStep_13._Final_configuration_then_save..png

As soon as you choose the region, the block title will now be visible at the top of the page that shows the enabled modules. The will be grouped by region, so this one will be under Help.

Remember to Save – scroll to the bottom of the page

tutuploadstutuploadsmedia_1318376971177.png

No changes will be saved until you click Save blocks.

Your result

tutuploadstutuploadsYour_result.png

If you followed all these steps you will have a contact form that looks something like this.

  1. There is a link on the menu to the form.
  2. The instructions are in the Help Region in a block you added.
  3. The correct email address shows. (this will change to the right one when the category is selected).
  4. There is a drop down list with the categories you created.

Author

0 0 votes
Article Rating
Subscribe
Notify of
guest

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Tor
Tor
11 years ago

Do you know if it is possible to use radio buttons instead of dropdown menu for the category ? (maybe an extension module..)

mtapia
11 years ago

How would I add an additional field to the Contact form? (Ex: Agency Name)

Digambar
Digambar
10 years ago

can you tell me how to display contacted users list

3
0
Would love your thoughts, please comment.x
()
x