Drupal 7: Webform-Emails: Send value of a field without its label? - drupal

I have a Webform on Drupal 7 and I am using it to email the administrator whenever an end user submits an entry on this form.
In the email template, I have defined a custom template and I am sending the data using
%email_values token.
However, I also want to send the value of a particular field on this form but not its label.
So I tried using %email[key] where key is the key of that field.
But this sends the label of the field as well as its value.
How can I avoid sending the label data in the email?

With Webform 3.x, it did not work at all on my website.
BUT, i've updated to webform 4.x, and it now works with the code :
Dear [submission:values:first_name],
It shows:
Dear Jean-Charles,
Thank you to user3641116, it helped!

Webform previously used its own custom token system to provide common tokens such as %title, %username, or %value[key]. In Webform 4.x, we use the token system provided by Drupal 7 core, which uses a format such as [node:title], [current-user:name], or [submission:values:key].
For all values: [submission:values]
D6 >> D7
%email[$key] [submission:values:$key]
%value[$key] [submission:values:$key:nolabel]
Example: [submission:values:your_details:first_name:nolabel]
See this for more examples: https://drupal.org/node/1609324

Well, this link solves the problem:
Drupal - Tokens for Webform Component Values
https://drupal.org/node/1010648
I used %values[key] to get submitted values.

Related

How to save data from field

I'm new using pega system and still learning about it. I have a trouble about saving the data from field to data page. What step must i do and can give me some explain ?
I'm using pega 8.1.1
Here is my image :
The Data Page: https://ibb.co/tZYZ0qh
The Login Form : https://ibb.co/ZYRdY6x
In the past i was trying to give the target but it doesn't work
My Target :
D_LoginCredentials[Password:.Login_Credentials.Password].Password
Here is the image :
Target Data Page : https://ibb.co/h83mtc3
I want to save the username and password after submit so i can do authentication for user, if user was submit it do checking the password that was right or not, if new user i want to add the data to page data.
Thank You
No need for the Data Transform if you just bind the controls in the Section directly to the properties on the Data Page.

Drupal webform enabled fields

I'm building form on my Drupal site using the Webform module and wanted to include some conditional questions.
The group of questions begins with a simple yes/no question. Depending on the answer of that boolean question, i'd like the questions after that to either carry on being disabled or become active for the user to answer. For example:
Do you have a Gas Certificate (Boolean) Yes/No
1a. Start Date
1b. End Date
1c. Upload File [Upload]
You can either write your own js to do so or try using a module https://drupal.org/project/conditional_fields. I did use if for some other forms but not webform. Please try

How to pass mail tokens to the admin user settings

How could i pass custom mail tokens from my custom module to the admin user settings page.In the admin user settings page I see a part like Welcome, awaiting administrator approval.In this part it shows the available variables are: !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.Is there any way by which i could add my own custom variables so that it can be accessed in the corresponding mail body..?I need to pass some variables from my custom module to this user setings part.Could some one help me with this..
For someone who might be looking for the solution,here is how i solved it.Do check the link below to see how to create your own tokens in the user admin settings.Its was a very quite useful piece of code .Anyways thanks to the uploader.. :)
http://www.innoraft.com/blog/use-profile-fields-tokens-user-emails-drupal

Webform submission: how to send the translation of a variable by mail

In a Drupal project, i have a basic weborm. As soon as the user submits one, an email is send with all the things he just wrote.
Example:
Imp_First_Name:%value[firstname]
Imp_Last_Name:%value[lastname]
Imp_City:%value[lastname]
Imp_Country:%value[country]
Imp_Email:%value[email]
Imp_Subject:%value[subject]
I have a problem on this line:
Imp_Subject:%value[subject]
Subject contains what the user have selected within a select list. My problem is when the website is set to chinese, all is written in chinese obviously but i don't want the chinese version to be sent. I need the english one.
For example :
In my webform, the user has the choice between 3 countries:
Afghanistan|阿富汗
Afrique du Sud|南非
Albanie|阿尔巴尼亚
I need the country name in latin alphabet ! How can i manage to do this?
thanks in advance for your help
It's a tricky one...
There is substitution and also two possible template layers. One comes from webform and second comes from mailsystem / mail handler module.
I'm assuming that the substitution is done before the template layer so the t() function should be applied either within a hook on that level or within the proper template file.
Debugging with XDebug would really help to solve the issue.

change user_profile_form form fields order

When a user login , the user will be redirect to a user profile page, which has a My account field set.
the field set has 2 fields, "Username: ", "Email address:". those 2 fields are generated by drupal.
those 2 field contained in a form which has a id ("user_profile_form") . I want to change the order of those 2 fields.
I have tried to intercept 'user_profile_form' , inside hook_form_alter.
code as follow:
$form['account']['name']['#weight'] = 1;
but that did not success, drupal did not even rendering the 'name' field, so no username: showed on browser.
What you did is absolutely correct, and probably did work. You can change the weight of the fields with the method described above.
The username field is not always rendered. The reason is that a persmission is required: change own username. If that perm is not set, you wont be allowed to alter you username and the field wont be shown.
Info on debugging.
Your info alone is not quite enough to debug. From what you describe, you are doing the right thing, but other modules could be making things a bit tricky for you. The devel module is quite good when it comes to debugging, ti defines two functions I use a lot when debugging:
dpm() pretty prints the variable to the message area using krumo.
dd() Prints / saves a variable to a log file. Useful when you can't view messages on the screen.
I would suggest that you look at the $form variable before and after you alter it.
Things that could make it go wrong:
Did you remember to pass the $form variable by reference using the & notation?
Is another module altering your form after you?
Are you checking for the correct form id, so you alter the correct form?
These are some pointers, before you bring more info, all I can do is guess to what your problem exactly can be. I did something like this a few days ago so I know what you describe shouldn't be a problem.

Resources