0

Drupal 8.9, Webforms 5.x

I have a load of forms that are all basically the same, except for the confirmation URL (a download link, essentially) and some minor tweaks to the handlers.

In an effort to reduce duplication, I've been looking into the possibility of using variants for this. I can create all the variants easily enough, but I'm at a loss as to how to include these on the correct pages.

The form itself is included in the layout of the content type as a block and I can specify a specific variant there via default submission data (as per image) but that's a single variant for the whole content type rather than a specific variant for a single page.

enter image description here

What's the best way to do this? Is it actually possible with variants at all? Or perhaps there's some other solution I've missed

0

You could create a hidden redirect URL element, which is then used as the confirmation redirect URL. The hidden redirect URL element can be populated using the 'Default webform submission data.'

| improve this answer | |
  • Getting the confirmation URL into the form isn't the issue here - I need a way of getting the block / webform / content type to use a different URL per content item, not just per block. – LordAro Jul 14 at 21:53
0

So the eventual answer wasn't variants at all, but webform nodes. Inserting a webform block into the content type's layout enabled me to use the [webform-submission:source-entity:foo] tokens, which were exactly what I wanted.

Important to note that you have to enable the "Webforms Node" extension for this (I've not seen this mentioned anywhere, so was confused about where the "References" tab was)

| improve this answer | |

Your Answer

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

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