Multiple routes to same webform but with paramters returning 'Page not found'

Hi

I have developed a web form (Using webform module version 8.x-5.0-beta23, Drupal 8) within my site. There is the requirement that if a user links to the webform from a specific place, certain parts of the webform have some preset options.

E.g. The webform in its most base form has a url of

http://abc.localhost/form/enquire

Linking from a regional page the link would indicate somehow that the user originated from a page where we want to preselect one of the radio buttons to the ‘Tailor Made Holidays’ option, so we would want to carry that through in the Url and act upon it in on the form. There will be a further requirement to have at least three different options, not just Region, but keeping it to one for this post.

I have done this successfully using Querystring’s such as

http://abc.localhost/form/enquire?region=tailormadeholidays and have managed to then preset value of form elements in the THEME_form_alter hook.

I’ve been told though that we cannot do this due to insecurities and should be using Drupal 8’s routing. All we and good and I have tried to adjust this accordingly but without any success.

Issue: All I am simply getting when I try visit the Url ‘http://abc.localhost/form/enquire/tailormadeholidays‘ is a Page not found notice on the site.

Reading the parameter related documentation on the Drupal API is fairly straightforward except when it comes to forms built by a 3rd party module.

I’ve created a module called abc_form_support to work with the webform and allow me to set up routing for it, source below if relevant.

My questions are:

1) Obviously, is there a glaring error(s) in my source that I have completely missed.

2) Is it actually ok to use query string in this case. I would be validating the url parameters in the THEME_form_alter hook and acting upon them there by preselecting elements, not doing queries with the parameters. Or is routing the ‘Drupal’ way for achieving this?

My YAML routing file is as follows (Was unsure if I actually even needed a controller or not)

abc_form_support.tailor_made_holidays:
  path: '/form/enquire/{holidaytype}'
  defaults:
    _controller: 'Drupalabc_form_supportControllerEnquireController::default_tailor_made_holiday'
    holidaytype: 'tailormadeholiday'

Controller

namespace Drupalabc_form_supportForm;

use DrupalCoreFormFormBase;
use DrupalCoreControllerControllerBase;

class EnquireController extends ControllerBase {
  function default_tailor_made_holiday(){
    return 'tailormadeholiday';
  }
}

The abc_form_support.module file is empty

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed