I want to add the feature that when users click a 'contact us' link for the contact page, from a node, the node title will be filled in the subject line of the contact form.
How do I do this?
I've tried creating a block for the link and having the code www.site.com/contact?subject="title" but it just takes you to the contact page, nothing in the subject field.


asearle’s picture

Hi there,

I've been trying to do this with the Prepopulate module ...


Which seems very promising but somehow it's not working for me.

If you could get it working, then I'd really be interested in the syntax needed to make it run.

Many thanks,
Alan Searle

LTech’s picture

Thanks for your help.
I got it working with Contact Us
but I can't figure out how to send node fields. eg [node:field_artist_name].
I've installed the 'token filter' module so I can send tokens and went to admin/help/token (with the token module installed) to find the list of tokens on the site but I can't get that to work. If you do let me know!

asearle’s picture

Hi there LTech,

So you got Prepopulate working ... I'm very jealous and am still not sure why it won't work with me

I've tried the following syntax in a whole load of permutations ...


... but it still won't work. And there are no error messages: It simply jumps to the form but no data is entered.

I looked in the HTML source and the field I want to write to has the following name and id ...

name="submitted[city]" id="edit-submitted-city"

So I am using the id in my call.

Do you have any thoughts on this? Is there an issue with my syntax? And how might I debug the situation so that I can check that the module really is working/active?

This is such a pain because prepopulate would really solve my problem.

Many thanks for any tips that you can give me.

All the best,

elblufer’s picture

What module are you using for your contact form? Webform is much more flexible than the default contact module. How I'd pull something from the URL using webform is to create a field where the default value is something like %get[source]. What this would do is pull, for instance "hello" from http://URL/contact?source=hello.

LTech’s picture

how do you do this with tokens?
I would like my subject line to read 'Inquiry about [node:field-product] by [node:field-author]

elblufer’s picture

You'd likely have to get the tokens into the URL somehow. If you could get, say URL?title=KEY&subject=KEY, then you could use the %get[title/subject] method from earlier.

There may be other solutions as well, but, that's the best I've got.

elblufer’s picture

Found this today while looking for something else. Perhaps it's what you're looking for? That being said, I have no experience with the module, so, it may not be. http://drupal.org/project/webform_patched

elblufer’s picture

Well...I wish I would have realized this a day ago, but, the new version of webform supports tokens. Just make sure to install the 7.x-4.x branch. You can set tokens in the default value to accomplish what you want.

asearle’s picture

Dear elbufer,

I checked back and we are using "webform" (Drupal 6). And prepopulate is installed and enabled.

I am testing with the syntax that you recommend but the field will not fill: The form is called and appears but the field remains empty.

So I am now rather stumped because I can't see how to debug the error. i.e. The field is simply not filled and there are no error messages so now I don't know if it is my syntax or something not installed or an incompatibility.

Do you have any suggestions/strategies that you can suggest?

Our intention is that the user should be able to use exactly this function to jump from a button on a course-listing to the form with the appropriate fields pre-filled. If we are unable to do this then it is pretty much a show-stopper for our website.

Many, many thanks for any tips that you can give.

Alan Searle

elblufer’s picture

Ah. Drupal 6. Unfortunately, there isn't a branch with Token support using Drupal 6, only Drupal 7 (which, I highly recommend upgrading to if you can). I haven't used prepopulate, so unfortunately I can't be of much help. Hopefully someone else can.

asearle’s picture

Hallo Elblufer,

Prepopulate seems to have a version for Drupal 6 but only a dev version for Drupal 7 ...


I'm getting more and more confused.


elblufer’s picture

I was suggesting to do away with pre-populate entirely and just use Webform's default token support in the 7.x-4.x branch if you were to upgrade. If you want to stay on 6 and use pre-populate, I'm not going to be able to help you because it goes beyond the scope of what I've used. Hopefully someone else can!