Search code examples
drupal-7blockdrupal-webform

Drupal Webform - How to load values from form, filled in a previous page


Working on Drupal, I have a page with a form made with "Webform" module, containing several fields (text fields and sliders) and a "Submit" button.
When the user enters the information and presses the "Submit" button, another page is loaded with custom code into it.
The new page is devided into 2 parts - the first one contains new information(based on the user input from the previous page); the second one contains (block) the same form, used in the previous page.

Is there a way to load the values, filled in the form from the first page into the new page?


Solution

  • First of all you would need to make a custom module, with the help of

    hook_form_alter

    You would need to store the previous form's information in cookies with prefix

    Drupal_visitor_

    and then display it in the new page like:

    $form['submitted']['FirstName']['#default_value'] = $_COOKIE[$firstname];

    Thanks