Pre-populate Contact Form Category in Drupal

I just discovered you can use pre-populate module to select a contact category in a Drupal contact form.

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.

Comments

01 Chad Kieffer
07/25/08 @ 13:06

Thanks for sharing this! I was bummed to find out that anonymous users cannot access personal contact forms. While I understand the underlying concern here, I still need a way to allow anonymous users to submit messages to registered users.

Since my site doesn't have many users, it won't be difficult to create a category per user and use this technique :)

02 cpugeniusmv
07/25/08 @ 13:38
Advertisement
03 jibbajabba
07/25/08 @ 14:21

@cpugeniusmv: I saw that in the Drupal thread. I already use Prepopulate though, so this solution served me well.

04 yaph
07/25/08 @ 16:29

Thanks for the hint! Here is the link to the module page: http://drupal.org/project/prepopulate

05 christefano
07/25/08 @ 17:26

Is this working for you with both Drupal 5 or 6? As far as I know, there are a few outstanding issues to have this work with Drupal 5:

http://drupal.org/node/101916

06 jibbajabba
07/25/08 @ 18:05

I'm still using Drupal 5 on all of my sites.

07 Chad Kieffer
08/04/08 @ 20:07

I wasn't able to get this to work with a Drupal 5.8 install :(

08 jibbajabba
08/05/08 @ 06:09

Chad: How are you forming your URLs?

09 Chad Kieffer
08/09/08 @ 18:57

Short urls. The specific link file relative and is "contact?edit[cid]=4".

10 jibbajabba
08/10/08 @ 07:01

Wierd. And it's still not working, huh? Sorry, but I'm not sure why it's not.

Advertisement
11 Chad Kieffer
08/10/08 @ 11:38

Nope, still not working. Here's the full link http://indiesf.com/contact?edit[cid]=4.

Oh well. There aren't too many categories on that contact form :)

12 jibbajabba
08/10/08 @ 14:33

And Prepopulate module is on?

13 Nik
09/05/08 @ 10:02

You can also use the contact_forms module that enables a separate contact form page for ech category. This will allow you to specify the following urls for the categories you have set up for the contact form: /contact/general for general, /contact/feedback for feedback, /contact/special for special. Basically it creates a contact form for each category set up which does not have the category drop down. Plus, /contact still works and will display the dropdown for a generic contact form where the users can choose.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <strong> <dd> <dl> <dt> <i> <li> <ol> <u> <ul> <code> <blockquote>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options