1.0 Problem/Motivation
There appears to be a regression - potentially this might arise out of CiviCRM? And be better placed lodged there.
The existing contact widget when the create new text displays now shows some html that should be wrapping the item instead of being escaped.
2.0 Detailed steps to reproduce (embed screenshots)
Create a new Webform. Add a civicrm existing contact. Save Via build -> Under form display - Set the existing contact widget to display with autocomplete. Save webform.
View form - cross off your logged in user if viewing logged in. Type some text in the autocomplete - see option at the bottom create new - is wrapped with text which have been escaped so render on screen.
Broken:

Working:

Site I have it working on is running:
CiviCRM 5.45.1
Drupal Core: 9.3.8
Webform 6.1.2
Webform_Civicrm 6.1.0
I've not tested interim versions
I have it not running on
Civicrm 5.46.2
Drupal Core: 9.3.8
Webform 6.1.2
Webform_Civicrm 6.1.0
Just to be clear - this html is append in code not via the UI. I assume that something is now treating it as unsafe and escaping it. and given the above I assume this is happening on the CiviCRM end somehow?
3.0 Proposed resolution
Return to previous behaviour.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | ContactNameEscaping.png | 32.5 KB | luke.stewart |
| Working.png | 12.63 KB | luke.stewart | |
| EscapedHtml.png | 13.64 KB | luke.stewart |
Comments
Comment #2
luke.stewart commentedComment #3
luke.stewart commentedComment #4
matt-trim commentedWe are also experiencing this on two sites:
Site 1:
- D9.3.8
- Civi 5.47.x
- Webform Civi Version: 6.2.0
Site 2:
- D7.78
- Civi 5.47.x
- Webform Civi Version: 7.x-5.8
My understanding of the internals of webform / webform_civicrm is quite low, so I'm just hoping to gain some more understanding of where to look and what a fix for this issue may look like.
Comment #5
luke.stewart commentedPotentially related to this is that a contacts name with the following special characters show in the autocomplete existing widget - but not in the text boxes - as escaped html.
Above was replicated on:
civicrm/civicrm-core 5.47.3
drupal/core 9.3.9
drupal/webform 6.1.2
drupal/webform_civicrm b66c5ce7e75b4cf5c5ec33ec8fea0db0f502cb7e
Comment #6
karingHere's a PR that will solve this for >=5.46.*
-> https://github.com/colemanw/webform_civicrm/pull/680
on Dec 11, 2021 -> Update jquery.tokeninput.js to 1.6.1
https://github.com/civicrm/civicrm-packages/pull/336
So I'm pretty sure that it went into the 5.46rc -> which leaves 5.45 with the old library.
Not sure how we can solve this. Ideas?
Comment #7
luke.stewart commentedThis resolves the html showing issue by removing it.
However it doesn't remove the problem for escaping of some special characters in the Display name.
Note further testing we can see that the "'" shows as expected in the drop down but as soon as you click it it shows escaped.
Comment #10
karingThis is merged -> https://github.com/colemanw/webform_civicrm/pull/729
Luke -> it solves the immediate problem by removing the HTML tags spanning the contact name. If you could please open up a separate issue for escaping of some special characters - that would be great.