HTML Special Characters in Label Not Rendering Correctly

159 views
Skip to first unread message

Chad Files

unread,
Oct 23, 2012, 6:19:27 AM10/23/12
to django-s...@googlegroups.com
I searched around and could not find anything to fix this. When rendering a label that has an HTML special character (& or ') the label display shows the semicolon at the end. I am using the AutoComboboxSelectMultipleWidget widget.

In the lookup items are rendered as such:

[{"id": "1", "value": "Community's Hospital", "label": "Community's Hospital"}, {"id": "2", "value": "Head & Neck Surgical Associates", "label": "Head & Neck Surgical Associates"}]

When they are rendered it renders like:

Community';s Hospital and Head &; Neck Surgical Associates

I believe it has to do with the way the highlights are rendered in and around line 170 in selectable/js/jquery.dj.selectable.js

Any help would be appreciated.

Mark Lavin

unread,
Oct 23, 2012, 8:19:43 AM10/23/12
to django-s...@googlegroups.com
Yes it appears this is a bug in the highlight matching when there is an empty search term such as with the combobox dropdown button. I created an issue to track this https://bitbucket.org/mlavin/django-selectable/issue/74/special-characters-not-rendering-correctly My first inclination would be to not attempt any highlighting when there is an empty search term but I haven't tried out that fix yet.

If this is causing a huge problem in the meantime you can disable the highlighting completely with $('#my_field').djselectable('option', 'highlightMatch', false); where #my_field is replaced by the appropriate jQuery selector for your field.

Chad Files

unread,
Oct 23, 2012, 8:40:46 PM10/23/12
to django-s...@googlegroups.com
It is not a big deal, just a minor annoyance. Thanks for the heads up. If I get a chance I will attempt a patch.
Reply all
Reply to author
Forward
0 new messages