Posted by mattmm on February 24, 2009 at 2:35am
Looking for some help/ideas on a custom contact form. Webform displays a token %title to pass, what i'm assuming is, the node title. However, it dosn't seem to be working correctly. I've posted a support question on the project page. So i'm looking to pass either the node title or node url of a webform that I have embedded in a block on said node.
Has anyone acheived passing custom tokens/arguments in a webform? Even further any luck passing custom cck fields in a webform or just a standard node that dosn't get published but e-mail via actions/triggers?
Any help would be appreciated.

Comments
Prepopulate
Have you tried using Prepopulate?
Erik Britt-Webb
drupal@ebrittwebb.com
Nope. I'll check it out
Nope. I'll check it out though - thanks!
matthewm.org
matthewm.org
Cool
Cool, I'll checking this out also.
Coach Hire Birmingham
Prepopulate and Location
Seems to be an issue between Prepopulate and Location though, and fieldgroup issues abound which we are using on the nodes in question. Quick test on a localhost and nada so far...
Yea, I don't think this will
Yea, I don't think this will be the answer for us. There has to be a way to pass the variables that dev render can see on a node into the results of a webform...
matthewm.org
matthewm.org
Don't use webform
I wouldn't recommend Webform. Stick with a CCK-based solution augmented by workflows, actions, and optionally views. It's standard now and the huge advantage of this is that the inquiries become part of the site, not resulting in a separate storage silo (email inbox) or having tracking issues when there is more than 1 administrator (whether or when the inquiry was answered).
(optional)
With this as a base, you can do (as I have done on various projects) a lot more.
You might use the Comment Dialogue module I wrote to enable an ongoing discussion between the original author and a role group (Site admins).
You could have the inquiry nodes listed on the user's profile to track.
You could embed the user registration form into the inquiry for anonymous users.
You could fire any number of actions based on time-elapsed from a workflow transition (e.g. follow-up emails).
...etc.
Good luck.
Workflow
Is that done with the Workflow Module?
--
My Drupal Tutorials
Yes I was thinking of going
Yes I was thinking of going CCK/Actions/Triggers route to get that done. I do like your idea of workflows and introducing time elapsed or not responded to etc.
At this point I will think somethign like that through for version 2.0 of the project. ;)
Right now, I have product page (node) with a "contact me about this product" form (webform in a block in a quicktab) at the bottom and I simply need the form to submit an email that says which product (or node page/url) it came from so the recipient knows what product the user wants to be contacted on. Also included in the form is Name, e-mail, and question fields supplied by the user.
matthewm.org
matthewm.org
webform email tweak
The workflows sounds like the best long-term.
In the short-term, bittennails found that setting the default value of a hidden form element to the token %get[q], it passes the node location or 'node/45' which worked great.
Webform has templates you can copy to your theme directory (see theming.txt in module folder for specifics).
I edited the email tpl file to explode() the node/45 string to get just the node id, then ran a query to grab the node title to display in the email. ('select title from node where nid = ' . $justnodeid;)
In addition to the themes.txt and the help in the tpl file itself, I found putting print_r(get_defined_vars()); helpful in finding how to call that specific submitted element.
Being very new to drupal, I'd be interested in how many guidelines I've broken by doing this.
Inserted into webform-mail.tpl.php:
<?phpprint t(' '); //extra line for formatting
?>
<?php
// passed item id from webform in form of 'node/45' - separating node/ from 45.
$itemarry = explode("/",$form_values['submitted']['5']);
$itemnode = $itemarry[1]; //taking just the numerical value (like 45) to run the query.
$sql = 'SELECT title FROM {node} WHERE nid = '.$itemnode;
$results = db_query($sql); // Run the query
while ($title = db_result($results)) { // there should only be one...
echo " Item Title: ".$title." - http://linktomysite.com/".$form_values['submitted']['3'];
}
?>
We were Drupal ninjas for a
We were Drupal ninjas for a day!
matthewm.org
matthewm.org
Hi, What is the best solution
Hi, What is the best solution right now to have a form with fields, which could be emailed as a contact form by the user?
Thanks a lot in advance for your reply!
greetings,
Martijn
Martijn, have you looked into
Martijn, have you looked into Webform? It can be used to build contact forms with customizable fields.
The Boise Drupal Guy!
Not email function working..
Hi,
I am using drupal 6.12. Webform is best for creating form as u like.but one issue with this that when a user submit the webform, all details send to administrator but a copy don't send to user. How this problem can resolved? i want to submit all user details to admin as well as a copy also send to user email? should i use another module instead of webform module? make it clear asap.
Regd's
Ritu Raj
In Webform, if you create a
In Webform, if you create a form component with the type "email" there is a checkbox for "E-mail a submission copy". Checking this will email a copy of the form results to the address in that field.
If your site has registered users there is also a checkbox called "User email as default" which automatically fills this field with the registered user's email.
And conditional emails as well
Webform will also let you set conditional emails based on the form input. For example, if your field "inquiry type" is "Send me a brochure", you could send a copy of the form or just the relevant part to the person in charge of sending brochures.
Webform gets knocked sometimes because its results aren't nodes and thus can't be exposed to Views, but if used for the purpose for which its built I have found it to be a lifesaving mod.
Conditional Emails How-to?
Could some please explain how to do this with Webform? I would like the same functionality as Contact Form where you can have a "Category" select box, and send the results of the webform to an email address based on what the user selected for "Category".
I cannot seem to find out how to do this.. any help is appreciated.
Another solution with Session
I used the Body Field of the webform with input format PHP Code to save the required values of the Node in a Session
<?
// Get the NODE Title
if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
$node = node_load(arg(1));
$_SESSION['mytitle'] = $node->title;
}
?>
Than i used the webform-mail.tpl.php and simply print out the session variable I need
<? print_r($_SESSION['mytitle']); ?>
drupal theme development
You can find contact page via drupal theme development on
http://www.ayushiinfotech.com/theming-contact-form-drupal-6page-contactt... and
http://11heavens.com/theming-the-contact-form-in-Drupal-6
Mandakini Kumari
George - Go2Hire
Hey
Webform is Good . You need to use with Captcha and Jquery Validation
Don't use contact form module when you use webform module .
because sometime execution mesh up , you will get blank Page .
Regards
George
ceo@Go2Hire.com
http://Go2Hire.com