- πΊπΈUnited States jrockowitz Brooklyn, NY
I am closing this and directing people to π Webform block doesn't take into account source entity when caching Needs work
Use case: webform in a sidebar block prepopulate/preserve submitted field values, if exist.
I've poked around module configuration and there are a few places which seems "relevant":
- Webform Settings > Submissions > SUBMISSION AUTOFILL SETTINGS. Single checkbox, no configuration.
- Structure > Block Layout > Configure Block > Webform Settings > Default submission data (YAML)
Expects something like first_name: first_name: '[webform_submission:values:first_name]'
- Webform > Build > WEBFORM ELEMENT > Edit > Advanced > Default Value.
Expects a token(?) [webform_submission:values:first_name]
- Webform > Add Element > Value.
Expects [webform_submission:values:first_name]
token.
- Webform > Add Element > Computed Token > Value.
Expects a token [webform_submission:values:first_name]
- Webform > Add Element > Computed Twig > Value.
Expects Twig {{ data.element_key }}
(?) or
{{ webform_token('[webform_submission:values:first_name]', webform_submission, [], options) }}
(???)
It looks like it works for stand-alone form and with SUBMISSION AUTOFILL SETTINGS checkbox.
Form in a block gives random results:
- sometimes it saves & uses submission values "per page", e.g. form values on, say, form submitted on node/1 differ from values submitted on node/2.
- sometimes form field values are empty after browser tab closed,
- sometimes tokens weren't replaced or submitted values left empty
- drush cache rebuild has no effect on this
Browsing the issue queue and Drupal Stackexchange has not been quite useful. Not sure this matter is being mentioned/covered in documentation/cookbook. Hence, a question if I may: what would be the right setup if we want to re-use the very first visitor's submission across all site pages? Would a hook_webform_something in a custom module be the best bet here, despite of all out-of-box settings available?
Haven't been worked with Drupal 9/Webform 6 before, it has been changed a lot comparing to its D7 counterpart!
Closed: outdated
6.1
Documentation
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
I am closing this and directing people to π Webform block doesn't take into account source entity when caching Needs work