How to set a $_POST var value as default value for a textfield webform component?


Webform 4 no longer uses so much of its own custom code.

It now uses drupal tokens like you would expect anywhere else.

Under the text area is a link "Browse available tokens." that will give you a javascript token browser to help you find the tokens you want.

You can access submission tokens like this: [submission:values:FIELD_KEY]

The special tokens you are after though like %post are no longer supported in webform 4.x.

For more information see

Your best bet for such token support would be for them to be added to the main token module or another third party token module in the global token space.

$_GET tokens have an issue however I don't think there is one for $_POST at this stage.

Alternatively you can write a hook_form_alter() in a custom module and set the default value there using $_POST.
That would be your easiest option I would say.

Tags: Webforms

Similar questions

How to set default value for textfield programmatically in drupal 7?
I need a form_alter code or something that I could use to set my field value. I'm getting the value from the parameter and I've tried a lot of ways but nothing works for me. This is the list of codes I've tried on my custom module: I think the code will be simple but the field is still blank. My field is just a single text field. Thank you in advan...
set webform component value using hook_form_alter in drupal
I have used form_alter function to change the value of a component but it does not change and default values is stored in the db. when i print the $form the updated values is displaying but not saved in db.
A post var error upon webform submitting programmatically
I need to update a webform submission using function drupal_form_submit. And upon updating an error is displayed. This form could not be submitted because $_POST was truncated to 5 input vars. PHP max_input_vars is 10000 and needs to be increased I tried to increase max_input_vars value even up to billion, but it doesn't helps. The webform is very ...
$_POST returns empty value in custom service
created a custom service resource to catch some data from the user through post method. but while I am accessing the service ie http://dev.localhost:8082/rest/send_mail/retrive.json Query: curl -X POST -H "Accept-Encoding: gzip" -H "Content-Type: application/json; charset=utf-8" sending the data in POST is : { "nid" :"1834", "recipient" :"charubach...
How to set available/unavailable dates in date webform component?
I have a webform with a date component. Then the visitor is able to select a date in a popup calendar. So far so good. I need to show available and unavailable dates in the calendar, then visitors only can select an available date. Look my capture: I'm trying with the availability_calendars which is a great modules. But I have 2 problems with it: 1...
How can I get $_POST data in a callback?
I've implemented hook_menu roughly as follows: I want to be able to post data to this url. So says $_POST is the following array: How can I access $_POST['data1'] and $_POST['data2'] inside the callback? Directly accessing $_POST seems to not work (it's var_dumped as empty).

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.