I need to set a $_POST variable value as the default value for a textfield webform component using Webform 4

In the Default Value field I filled with %post[my$_PostVar] but is not working.

update: it seems like Webform 4 lost the %get and %post tokens comment-6337368

any thoughts...


I installed the Availability Calendars module. This module shows a availability calendar and provide a formlet to allows the visitor to submit a booking.

When this form (the formlet) is submitted this is sent to a webform where the visitor will continue filling the personal data to complete the booking.

Then form let send these vars: $_POST['arrival_date'] and $_POST['departure_date'] to the Webform. Here is why I need to fetch these $_post values in the Webform components

Booking integration by providing a small "formlet" that can post to (e.g.) a Webform.

and here some part of the Readme file of the module:

Defining the 'complete booking form' webform -------------------------------------------- This part assumes you are using the webform module.

  • Define the webform components that the visitor should complete like name, e-mail, address, number of persons, etc.

  • Define webform components for the dates that are already filled in:

    • Begin date (default value: %post[from_display]): the begin date.

    • End date (default value: %post[to_display]): the end date.

  • 1
    Maybe you should try to explain the end goal - it sounds like there maybe is a more optimal way of doing what you want to accomplish.
    – googletorp
    Commented Aug 11, 2012 at 10:40
  • ok, I elaborated at the bottom of the question.
    – chefnelone
    Commented Aug 11, 2012 at 17:57
  • @chefnelone This is exactly my requirement. I need a booking module that integrates with Availability and Webform module. Have you had any progress with this issue?
    – jan
    Commented Jul 18, 2014 at 13:22

1 Answer 1


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 https://www.drupal.org/node/1001798

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 https://www.drupal.org/node/550164 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.