I am working on multi-level forms, and storing form values in session to display result on final page with some form values. but its works fine only for authenticates users.

For anonymous users session value updates only after clearing cache on the page. but values updates in session variables but doesn't update in theme variables.

Tried all methods:

  • \Drupal::request()->getSession();

  • \Drupal::service('user.private_tempstore')->get('module');

  • $_SESSION['module']

Same results for all. Please help!!

  • If you want to have dynamic values per-anonymous user you have to implement lazy builder, otherwise you will have these exact caching issues(that's how caching works). – user21641 Jul 31 '18 at 20:29
  • Is there any other method I can store forms value (user inputs) in a multi-step form and then render/display all the values captured via controller ? – acxes Aug 1 '18 at 13:30
  • check out ajax forms [#188730] – user21641 Aug 1 '18 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.