Is it possible to handle querystring parameters in webform module in Drupal 8.x with Uppercased letters like in this example? example.com?collectionId=123 (notice uppercase "I")

Webform fields requires machine names (capital letters not allowed). Currently i get forms pre-filled as expected using collectionid=123 instead of collectionId=123 but in my current scenario using the capital letter is a requirement in order to keep some legacy external process working untouched.

Any suggestions?


You need to write some custom code to lowercase the query string parameters before the webform is built and displayed.

Another hack would be to pass the query string parameter using a token [current-page:query:collectionId]

|improve this answer|||||
  • Thanks for the quick reply. I'm currently extending the WebformHandler successfully to make a custom PUT remote post to an external service. This post helped me out on how to achieve it. Create a Webform Handler in Drupal 8 What would be the suggested way to insert the mods working inside a custom module? via a hook? If there's any code example or docs on how to achieve this, please share the reference. As i need to construct the PUT url dynamically i think your second suggestion might not be enough for my case – lithiumlab Dec 11 '17 at 16:28
  • Trying your second suggestion (token) as default_value in the source YAML of a field kind of works, but displays the name of the token when the value is empty or not included in the query string. A twig computation here is possible? It would be ideal to be able to use things like the |default("") filter in this use case. – lithiumlab Dec 11 '17 at 18:51

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.