Categories

Featured templates

Drupal 7. How to setup Contact Form and manage contact details

Norman Fisher September 28, 2012
Rating: 5.0/5. From 1 vote.
Please wait...

This tutorial is going to show you how to add a contact form to your Drupal template, change the email address and edit the form fields.

How to add the contact form?

  1. In your Drupal admin go to menu Modules – and enable the one called Contact7.7 (Enables the use of both personal and site-wide contact forms). Check it and click Save Configuration at the bottom.
  2. Make sure that under the Modules menu -> Panels all these modules are enabled:
  3. Go to menu Structure -> Pages
  4. Click on Import Page
  5. Page name should be Contacts
  6. Path should be contacts
  7. Allow overwrite of an existing page should be checked.
  8. To Paste page code here add the following:
  9. $page = new stdClass();
    $page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
    $page->api_version = 1;
    $page->name = 'contacts';
    $page->task = 'page';
    $page->admin_title = 'Contacts';
    $page->admin_description = '';
    $page->path = 'contacts';
    $page->access = array();
    $page->menu = array();
    $page->arguments = array();
    $page->conf = array(
      'admin_paths' => FALSE,
    );
    $page->default_handlers = array();
    $handler = new stdClass();
    $handler->disabled = FALSE; /* Edit this to true to make a default handler disabled initially */
    $handler->api_version = 1;
    $handler->name = 'page_contacts_panel_context';
    $handler->task = 'page';
    $handler->subtask = 'contacts';
    $handler->handler = 'panel_context';
    $handler->weight = 0;
    $handler->conf = array(
      'title' => 'Panel',
      'no_blocks' => 0,
      'pipeline' => 'standard',
      'css_id' => 'contacts',
      'css' => '',
      'contexts' => array(),
      'relationships' => array(),
    );
    $display = new panels_display();
    $display->layout = 'flexible:two_columns';
    $display->layout_settings = array();
    $display->panel_settings = array(
      'style_settings' => array(
        'default' => NULL,
        'center' => NULL,
        'column_right' => NULL,
        'second_column' => NULL,
      ),
    );
    $display->cache = array();
    $display->title = '';
    $display->content = array();
    $display->panels = array();
      $pane = new stdClass();
      $pane->pid = 'new-1';
      $pane->panel = 'center';
      $pane->type = 'contact';
      $pane->subtype = 'contact';
      $pane->shown = TRUE;
      $pane->access = array();
      $pane->configuration = array(
        'override_title' => 0,
        'override_title_text' => '',
      );
      $pane->cache = array();
      $pane->style = array(
        'settings' => NULL,
      );
      $pane->css = array();
      $pane->extras = array();
      $pane->position = 0;
      $pane->locks = '';
      $display->content['new-1'] = $pane;
      $display->panels['center'][0] = 'new-1';
      $pane = new stdClass();
      $pane->pid = 'new-2';
      $pane->panel = 'second_column';
      $pane->type = 'block';
      $pane->subtype = 'block-1';
      $pane->shown = TRUE;
      $pane->access = array();
      $pane->configuration = array(
        'override_title' => 1,
        'override_title_text' => 'Our Location',
      );
      $pane->cache = array();
      $pane->style = array(
        'settings' => NULL,
      );
      $pane->css = array();
      $pane->extras = array();
      $pane->position = 0;
      $pane->locks = array();
      $display->content['new-2'] = $pane;
      $display->panels['second_column'][0] = 'new-2';
    $display->hide_title = PANELS_TITLE_NONE;
    $display->title_pane = 'new-1';
    $handler->conf['display'] = $display;
    
  10. Click Import at the bottom.
  11. On the next page, click Save at the bottom.
  12. On the same page, where it says Menu No menu entry under Summary, click edit to add a menu tab pointed to your contact page.
  13. Now you can open the front page of your site and click the Contacts menu to see the page with the form you have just created.
  14. You can always go back to page settings under Structure -> Panels -> Contacs -> edit.

How to change the contact form email address?

To activate the form/to change the email address go to you Structure -> Contacts Form menu -> edit. Click Save at the bottom to save the changes.

How to change the contact form fields?

To change the fields that your contacts form comes with:

Your name *

Your e-mail address *

Subject *

Message *

Send yourself a copy.

Send message

you need to edit the corresponding lines in the contact.pages.inc located in the\modules\contact folder:

‘#title’ => t(‘Your name’),

‘#title’ => t(‘Your e-mail address’),

‘#title’ => t(‘Subject’),

‘#title’ => t(‘Message’),

‘#title’ => t(‘Send yourself a copy.’),

‘#value’ => t(‘Send message’)

The title “Contact” can be changed in your Drupal admin panel under the menu Structure -> Pages -> Contacts -> (left menu) Settings -> Basic -> Administrative title .

Feel free to check the detailed video tutorial below:

Drupal 7. How to setup Contact Form and manage contact details

Drupal Website Themes
This entry was posted in Drupal Tutorials and tagged contact form, drupal, manage, setup. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket