- July 2010 (1)
- June 2010 (4)
- May 2010 (3)
- April 2010 (6)
- March 2010 (6)
- February 2010 (8)
- January 2010 (13)
- December 2009 (4)
- October 2009 (2)
- September 2009 (1)
Drupal Simplied Contact form
A site I'm working on has a simple contact us form in the footer of every page. I didn't want the long drawn out contact form with all the name, subject, email, message fields. Here is what I did.
Installed the formblock module
Easy enough, install the module, enable the block so that the contact form now shows in the footer.
Simply the contact form
Now we want to hide some of the fields in the contact form.
In your template.php file, you'll want to add the following lines.
function basic_theme(){ return array( 'contact_mail_page' => array( 'arguments' => array('form' => NULL) ) ); } /** * Hide and autofill some fields in the contact form. * */ function basic_contact_mail_page($form){ $form['subject']['#value'] = "Website question"; $form['subject']['#type'] = 'hidden'; $form['name']['#type'] = 'hidden'; $form['name']['#value'] = 'Website Customer'; return drupal_render($form); }
As you can see I'm using the Basic theme from Drupal. If you're using a different theme you'll want to change the word basic to your own theme (e.g. blueprint).
Now you have a simple contact form.

Comments
Post new comment