Pre-populate contact form

BWPanda - July 17, 2008 - 06:27

Is there a way I can pre-populate the contact form with certain data?

Example: A user is viewing a node. They click a link in the node to enquire about it. The contact form is displayed with the node's name entered in the subject field.

Is this possible, and if so, how?
Thanks!

You can create a new module

CleanCutRogue - July 17, 2008 - 08:01

You can create a new module which does the trick, implementing hook_form_alter();

Are there any other ways of

BWPanda - July 17, 2008 - 12:48

Are there any other ways of doing it?
I'm not a module developer and was hoping for something more GUI based, or an existing module that does something similar...

I found a way...

BWPanda - July 20, 2008 - 23:30

I eventually found the Advanced Contact module. There's no official v5 release, but it seems to work fine as is.

Problem solved!

In Drupal 5 you just add edit[cid]=

jibbajabba - July 25, 2008 - 15:03

I just discovered you can use prepopulate module to select a contact category. For instance, if you have 3 categories for your contact form and want to pass an url to pre-select category 3, just pass ?edit[cid]=3 in your link, e.g. http://yourdomain.com/contact?edit[cid]=3. Nice.

Thanks for that

BWPanda - August 11, 2008 - 04:52

Prepopulate seems to be better supported, and is available for D6.
I might use it from now on.

Are you sure?

zbricoleur - August 18, 2008 - 18:20

It is not working for me. And looking at the code, I don't see how it could. Do you have a custom contact form set up?

it isn't working for me, too

mutzel - September 24, 2008 - 12:31

it isn't working for me, too .. using drupal 6 and the standard contact form

Try v2.x.dev

BWPanda - September 24, 2008 - 14:13

Sorry about that. I hadn't actually tested it until now, and you're right; it doesn't work on the basic contact form.
However, if you download the 2.x.dev version, you should find that it works as expected...

D5 'solution'

kees@qrios - November 4, 2008 - 10:53

For D5:

Current module version 5.x-1.3.

simple hack to make the contactform work:
Change line 42

  if (isset($node)) {

to
  if (isset($node) || $form_id == 'contact_mail_page') {

Drupal ontwikkeling

 
 

Drupal is a registered trademark of Dries Buytaert.