Create a 'Contact Us' Form
[Using Drupal 5 or above? If so this HOW TO doesn't apply; instead check out Create a 'Contact Us' Form using the built-in Drupal 5 Contact Module.]
Note: don't worry about the length of this HOW TO, it's actually more difficult to read it than to do it! It should only take you about 10 minutes.
Step 1: Ensure that BOTH the forms and survey modules are enabled.
Why? Because a contact us form is a specific type of survey and the survey module uses the forms modules since all surveys are forms.
- Login
- Click on 'administer' on the left hand side
- Click on 'modules'
- Enable both the forms and survey modules by clicking the the boxes next to each and clicking 'Save configuration'.
- Check the permissions so that 'anonymous' users and other roles can submit surveys. Click 'administer' then 'users', then the 'configure' tab', then the 'permissions' sub-tab. Check the boxes in the "submit surveys" row for each role you want to contact you, which will probably be all of them, including the anonymous users role.
Step 2: Create the Contact Us form
- Click on 'create content'
- Click on 'survey'
- Enter a title which will be something like 'Contact us' surprisingly enough :-)
- Add a meaningful 'Path alias' so that your Contact Us form is at a meaningful URL e.g. if you want it to be at yourdomain.com/contact add a Path alias of contact
- Add some "Intro text:'. For a Contact Us form, this will typically be your email address and phone number in case people don't want to use the form and want to contact you directly. e.g. "We at Acme Foobars inc. love to hear from foobar users. Email us support@acmefoobars.com or call us at +1 555 1212. Alternatively, fill out the following fields to get in touch -- we'd love to hear from you!"
- Under "Email address:", enter your email address. This is OPTIONAL but unless you like manually checking whether people have contacted you, it's best to put an email address so you get automatically notified when people contact you.
- Click on "Preview". You will just see your intro text and NOT the Contact Us form.
- If you are happy with the intro text, "Click on Submit" otherwise revise the info appropriately and go back to Step 7.
Step 3: Add the fields you want to the Contact Us form
Typically these fields will be, 'Name', 'Email', 'Subject', and 'Comments or Questions' for a Contact Us form. But of course you can and should add in your own custom fields (e.g. membership number) as appropriate. Repeat the following 7 step process for each of the Name, Email, Subject and Comments or Questions fields and any custom fields you wish to add.
The 7 Step process for adding a field
- Click on the 'form' tab
- Click on 'add field'
- Select the "Type:. For Name, Email and Subject this will be a 'textfield', since these fields are all single line text fields. For Comments or Questions, this will be 'textarea' since this field will be a multiple lines which is what text areas are
- Select a Weight to make the field appear where you want it. Weight is a number from -5 to 5 which defines the order in which form fields are shown. Ligher fields "float up" towards the top of a form. For a Contact Us Form, you want Name to be on top followed by Email, followed by Subject and Comments or Questions One possible scheme would be to have Name as -5 , Email as -3, followed by Subject as -1 with Comments or Questions being 1 (I usually leave a gap of 1 between fields to allow me in to insert fields easily at a future date).
- Make sure 'Required Field' is checked appropriately. This is up to you of course, but for a Contact Us form, usually Name, Email and Subject are required fields and Comments or Questions are not required.
- Set 'Validation function:' appropriately. For Name, Subject and Comments or Questions, set it to '---', and for Email set it to 'email address' so the system will validate that the user actually entered an email address.
- Click on Save Field
Step 4: Add it to your site
Usually, your Contact Us Form will appear as a link in your main navigation since you want it to be accessible from everywhere and it's a primary function of your site. To do this, follow the How to Edit Your Primary Navigation like so:
- For link text, enter Contact or Contact Us or whatever you think is appropriate.
- For url, enter contact or whatever Path alias you entered in Step 2.
Step 5: Test your Contact Us Form
- Surf to the URL you set up for your Contact Us form in Step 2 e.g. yourdomain.com/contact
- Fill in the form
- Click on Submit and follow the procedure in Step 6 and verify that your information was collected successfully.
Step 6: Collect the results as they come in
- You can do this in two ways: You will receive the email in the account you filled in Step 2 OR
- You can also surf to the URL of the form you set up in Step 2 e.g. yourdomain.com/contact and click on the 'responses' tab (of course you need to be logged in to see this tab!). Then click on view to see the response you want to view.
Step 7: You are done, take a break!
Do a little dance, have a coffee, eat some mohnkuchen, do whatever works for you!
Comments
Note for Step 1, #5
I think you mean to go to administer > access control > set the proper permissions here  ?
Otherwise, great instructions! It works! Thanks!