Dynamic Content in Webform Module?

dignosis - December 30, 2008 - 18:55

I have a letter writing campaign on a client's site and I want the name of the person to dynamically be added to the message textarea to be sent with the letter.

I have tried

%session[first_name]
%get[first_name]

I've tried

$first_name

with PHP snippets turned on.

I'm a newbie and I'm baffled.

Any help is greatly appreciated!

What is 'first_name'? A core

WorldFallz - December 30, 2008 - 19:03

What is 'first_name'? A core profile field?

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

it's one of the 'keys'

dignosis - December 30, 2008 - 19:48

it's one of the 'keys' created in webform denoting the textfield containing the variable $first_name, one of the variables that i want to dynamically populate my letter.

thanks!

Ah ok-- but where are you

WorldFallz - December 30, 2008 - 19:52

Ah ok-- but where are you capturing the first name of the user filling out the form? You can't prepopulate the field if you don't first capture the value somewhere.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

right. the form looks

dignosis - December 30, 2008 - 20:00

right. the form looks roughly like this

first_name
last_name
street
city
state
zip

message (which has editable content by default)

i want to add

first_name last_name
city, state

to the signature of the letter.

here's the URL

http://bootblago.com/node/7

duh-- the fog has finally

WorldFallz - December 30, 2008 - 20:35

duh-- the fog has finally cleared, lol. What about $_POST [ 'first_name' ]?

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

i just tried that both with

dignosis - December 30, 2008 - 20:46

i just tried that both with and without the <?php tags and it just tries to read those as cleartext.

i also tried it as %post[first_name] and no such luck either.

it seems like the textarea is not able to handle the PHP tags for some reason, which was why i was trying to use the % keys.

it's odd cuz the main descriptions, etc for the webform can handle PHP but the textarea itself doesn't seem to be able to collect any variables.

Ahh... we're looking in

WorldFallz - December 30, 2008 - 21:58

Ahh... we're looking in different places. I think you need to do this in the form configuration 'additional processing' section which does accept php and provides the entire $form and $form_state variables for you to use.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

this is probably a very

dignosis - January 3, 2009 - 21:33

this is probably a very stupid question, but where would i find the form configuration 'additional processing' section?

hyelp.

dignosis - January 5, 2009 - 15:52

hyelp.

Sorry-- i was away for the

WorldFallz - January 7, 2009 - 15:34

Sorry-- i was away for the holidays.

The 'additional processing' textbox is in the 'Webform advanced settings' fieldset right on the node/edit form for the webform. Just edit the webform node, expand the fieldset, and you should see the 'additional processing' textbox at the bottom of the fieldset.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

 
 

Drupal is a registered trademark of Dries Buytaert.