Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By dignosis on
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!
Comments
What is 'first_name'? A core
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'
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
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
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
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
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
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
this is probably a very stupid question, but where would i find the form configuration 'additional processing' section?
hyelp.
hyelp.
Sorry-- i was away for the
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