consider the following HTML element in (View) Source page

       data-district: '[{Test!test!:Test!Test!}]'

To my suprise when I check the browser for data-district it is an empty string. So my question is how to escape square brackets in (View) Source page if they are placed at the beginning([) and end (]) of string


The below YAML render the data-district attribute without any problems via the Bartik theme,

  '#type': select
  '#title': District
    one: One
    two: Two
    three: Three
    data-district: '[{test!Test!}]'

Below is a screenshot of the output.

enter image description here

In your example, the #attributes YAML is indented incorrectly.

  • I now see the issue which is '[{Test!test!:Test!Test!}]' is being interpreted as a token because of the colon (:) and being removed. Please create a ticket in the webform module's issue queue and we can fix it. – jrockowitz Nov 1 '17 at 2:20
  • Here is the ticket. drupal.org/node/2920199 – jrockowitz Nov 1 '17 at 11:21
  • This issue has been fixed. Please download the latest dev release of the webform module to review. – jrockowitz Nov 1 '17 at 13:29

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.