My site is a directory of professionals offering a service (my users), my visitors are prospect leads for my users.

The form I'm creating is a quote request, and it's meant to be from a visitor to a user, but the form emails me instead and I'd like it to be emailed to my users.

Each user will have the form linked to their profiles, just like the contact form.

Is there a way of doing this?

Please let me know.

Comments

quicksketch’s picture

I'm not sure if this is directly possible or not. It's easy enough to make a hidden field that contains an e-mail address, then include that field as a "Conditional e-mail recipient". That would make it simple to send an e-mail to any e-mail address. However, setting the hidden field's value could be a little tricky.

Anyway, I'm going to cut short further explanation because I'm not sure Webform is a suitable fit for what you're trying to accomplish. If there's only a single webform for your entire site to use, you'll run into both performance problems and users won't even be using the data analysis features (since everyone's requests will all be jumbled together). What you'd really want is separate results for each user, so they can look through their contact history. If you did this with Webform however, every form would be separate, meaning if you ever wanted to change the form, you'd need to update all of them individually.

So... bottom line, I think a CCK/Views/Actions would be a more suitable fit for your needs. Then you have a single form (a content type) that you can customize across all users, use Views to create custom reports for each user, and use Actions to send an e-mail to the user when a new node is submitted.

manoloka’s picture

Status: Active » Closed (fixed)

Thanks :-)

Manuel

P.S By the Way, where can I see the data analysis features ?

manoloka’s picture

Status: Closed (fixed) » Active
fossie’s picture

Maybe you can just thick the checkbox Send a copy when you add the email field of the user. You can adjust this as well going to the components and edit the email component your user uses.

manoloka’s picture

I'm not sure if I understand what you mean when you say;

Maybe you can just thick the checkbox Send a copy when you add the email field of the user. You can adjust this as well going to the components and edit the email component your user uses.

But users won't be submitting the form, it will be anonymous visitors who submits the form.

The form will be accessed from a user business listing so I can easily send a variable with the email address, but how do I get that into the hidden tag?

... I wonder if it would be too difficult to, add to the "Email Address"(in Webform Settings), an option to allow a php script to get the address. I'm sure I've seen this sometime as an option to override a default setting.

Or maybe just giving the "Email address" setting the input format option would do it?, even though it makes more sense the above option.

Do you know what I mean? Would it be possible?

meeotch’s picture

I've been trying to get a similar thing working... A webform that mails to the submitter of a previous webform. (So, pulling the previous submission from webformA out of the database, and changing the value of a hidden "email" field in webformB.) No luck yet, though...

I thought I could do it in the "additional validation" code. Tried setting the submitted / submitted_tree values directly, and also via form_set_value (recommended here: http://drupal.org/node/160160#comment-820709), via code like this:

<?php
$x['#parents']['submitted_tree'] = array('email');
form_set_value($x, "check@redconnector.com");
?>

But no luck. Hoping someone else has made a bit of progress. I'd rather not end up using CCK, and creating a node for every submission.

UPDATE: using this code:

$y['#parents']= array('submitted', 'email');
form_set_value($y, "check@redconnector.com");

I managed to get both submitted and submitted_tree 'email' values to be changed. The $_POST 'email' value still retained its old value, but the emails went to the right place. And there was much rejoicing!

manoloka’s picture

I managed to get both submitted and submitted_tree 'email' values to be changed. The $_POST 'email' value still retained its old value, but the emails went to the right place. And there was much rejoicing!

I may be not understanding what you mean but I think it has nothing to do with what I'm trying to do, does it?

manoloka’s picture

What about the Additional Processing field?

Could I add a code that forwards the whole form submission to a chosen email address?

meeotch’s picture

I may be not understanding what you mean but I think it has nothing to do with what I'm trying to do, does it?

It does, in fact. I used the code I quoted above to stuff an arbitrary email address into a hidden field during "additional validation". I then used that field within the webform UI to direct the confirmation email where I wanted it to go.

manoloka’s picture

I'm still doing something wrong.

I can create the field with the email address, showing in the email received but it won't send the email to that address.

I'm using the exact code as you gave, only changing the email address;

 <?php
$y['#parents']= array('submitted', 'email');
form_set_value($y, "my@emailaddress.yo");
?>

do I need to replace anything else?

quicksketch’s picture

You don't need to use form_set_value() in these cases. Because the $form_values variable is available to you, you can set these values directly.

$form_values['submitted'][$cid] = 'some value';
meeotch’s picture

I'm using the exact code as you gave, only changing the email address;

You need to make sure you have your email field selected under "Conditional e-mail recipients" in the webform configuration. That should do it.

Regarding setting values directly: I could have sworn that I tried that, and for some reason it wasn't working for me. (Something about the values being re-set before submit, particularly with hidden fields?) But my knowledge in this area is pretty incomplete... Anyway, if it works for you, it works.

manoloka’s picture

You need to make sure you have your email field selected under "Conditional e-mail recipients" in the webform configuration. That should do it.

How can I do that if that field isn't showing there?

In the email I received I get this; (apart from all the other fields).

Assessors email:
Assessors email: theemail@hotmail.com

I imagine if "theemail@hotmail.com" would show in the right field (the one above) it may get sent as it's the field that is set as "Conditional e-mail recipients".

But, why is it showing 2 fields?
why is the 1st empty?

manoloka’s picture

Yeeeeeessssss

I've manage to get it sent in a much easier way.

I've created a hidden field called "assessor email" and is set as "Conditional e-mail recipients".

Set the default to %get[email] and make sure the link that takes you to the form has a ?email=myemail@whatever.com

That's it, easy isn't it?

manoloka’s picture

Status: Active » Fixed
quicksketch’s picture

Nice solution manoloka. Thanks for the followup.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.