0

I've been given a requirement to allow for a webform to be inserted into another webform's confirmation page.

At first I tried this with a token I could insert into the confirmation message, the form appears fine, but of course, the new webform is inside of the "parent" webform, which strips out the form tag.

So now I have overriden a few of the webform and webform submission entities handlers, so I can write my own custom getCustomForm function, I can get the new form appearing, but the submit behaviours are weird.

I've tried many things including:

return Webform::load(
    $webform->getThirdPartySetting('my_module', 'webform')
)->getSubmissionForm();

and

$form['confirmation'] = [
    '#type' => 'webform',
    '#webform' => $webform->getThirdPartySetting('wwf_fields', 'webform'),
    '#source_entity' => $webform, 
    '#message' => [
        '#type' => 'inline_template',
        '#template' => $webform->getSetting('confirmation_message')
    ]
];

Is there some combination of code I'm missing, or am I trying to bend the system a little too much?

Thanks!

1 Answer 1

0

Could you not just redirect after a submission so it goes to a node page that has the other form on it? Rather than trying to put the webform into the message? As that message content could be in a drupal message rather than page content

1
  • I could, but thats something I've been asked to avoid if possible.
    – user69676
    Jul 4, 2018 at 8:22

Your Answer

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