HTML Special Characters in Label Not Rendering Correctly

Showing 1-3 of 3 messages
HTML Special Characters in Label Not Rendering Correctly Chad Files 10/23/12 3:19 AM
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.
Re: HTML Special Characters in Label Not Rendering Correctly Mark Lavin 10/23/12 5:19 AM
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.
Re: HTML Special Characters in Label Not Rendering Correctly Chad Files 10/23/12 5:40 PM
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.