Improper display of ampersand (&) in select list. When adding a taxonomy as a CCK field and displaying it as a "Select List", it displays as &. See screenshot attached
It displays as expected in when choosing "Checkboxes/Radios".
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | content_taxonomy_301124-29.patch | 611 bytes | Josh Benner |
| #23 | content_taxonomy_301124.patch | 909 bytes | mstrelan |
| #17 | Content Taxonomy Ampersand Bug.png | 28.82 KB | dmetzcher |
| #8 | content_taxonomy-correct_imroper_display_of_ampersands.patch | 504 bytes | ck9 |
| Select List with ampersands | 22 KB | capellic |
Comments
Comment #1
mh86 commentedHi!
Thanks for your report.
There was one check_plain too much for select lists, I fixed that and committed it to the D6 dev version.
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #3
ck9 commentedI have this issue in 6.x-1.0-rc1. The ampersand in select lists is rendered as &.
Comment #4
ck9 commentedThis is important any ideas please?
Comment #5
mh86 commentedthis may also depend on your CCK version. what version of cck are you using and is there a difference between content taxonomy beta6 and rc1?
Comment #6
ck9 commentedI just tried upgrading to the latest CCK module (6.x-2.4) and the problem remains. I have Content Taxonomy 6.x-1.0-rc1. Please advise, thanks.
Comment #7
ck9 commentedNow tried the 6.x dev but no difference.
Comment #8
ck9 commentedOut of desperation I tried editing it myself and by some miracle actually fixed it. I've attached a patch although I wrote it by hand and not sure if it follows the proper convention for patches. Either way it should be clear which line was changed.
Comment #9
mh86 commentedremoving check_plain is a bad idea and dangerous. additionally your patch wouldn't change anything for select list. maybe you have been adding another check_plain instead?
Comment #10
ck9 commentedIf the check_plain is left in then the ampersands are displayed incorrectly. I'm not sure why nobody else is having this problem.
If anyone has an alternative solution then I'd be happy to try it, but this hack allowed an otherwise ready site to go live (even if removal of the check_plain impairs security).
Comment #11
mh86 commentedI'm still wondering, why this patch changes something with select lists. The original code says:
it does a check_plain for every widget (like radios/checkboxes), except for a select list.
if you remove the second check_plain it only can have effects on widget not of the type 'content_taxonomy_select'.
so, I have to ask again, which widget are you exactly using? you can see that in your field settings or in your database (table content_node_field_instance)
Comment #12
ck9 commentedI noticed that my select lists returned to displaying
&instead of &. I just installed the latest RC2 version (without any custom patches) and the problem remains. Any ideas?Additional info.: the problem is within an exposed views form, which is used as a block within a panels page.
Comment #13
The_Forum commentedI'm also having the same problem. I am using the select list for an exposed views filter and see the html entity instead of the ampersand character. I'm using the latest RC2 and have upgraded CCK to 2.6.
Comment #14
robby.smith commentedsubscribing
Comment #15
xjmThe views exposed filter selector is separate from Content Taxonomy's CCK option widgets, so the problem you're experiencing might not be related to the initial issue.
I'm unable to duplicate the ampersand being rendered as
&entity in the exposed filter select box. I'm using Drupal 6.16, Views 2.8, Content Taxonomy rc2, and CCK 2.6. Can you provide some steps to reproduce?Comment #16
davidkronfeld commentedsame issue here.
drupal 6.16
views 2.10
content taxonomy 1.0 rc2
content taxonomy autocomplete 1.0 rc2
content taxonomy options 1.0 rc2
content taxonomy tree 1.0 rc2
option widgets 2.6
Comment #17
dmetzcher commentedSame issue here. I see it in select dropdowns and in checkboxes displayed in exposed filters. I've attached a screenshot of a list of checkboxes.
Drupal 6.16
Content Taxonomy 6.x-1.x-dev
Comment #18
Alexandros78 commentedHere is what I did to solve this:
Open the form.inc (/drupal/includes/form.inc) and change line number 1447
from:
$options .= '<option value="'. check_plain($key) .'"'. $selected .'>'. check_plain($choice) .'</option>';
to:
$options .= '<option value="'. $key .'"'. $selected .'>'. $choice .'</option>';
Hope this helps!
Comment #19
halmsx commentedhi
editing the core modules is not advisable. what i did was edit a file from this module, instead of core module.
im using drupal 6.17 and content taxonomy 6.x-1.0-rc2.
the file is 'content_taxonomy/includes/views/content_taxonomy_handler_filter_many_to_one.inc'.
the original function,
add a few lines in the middle.
im not sure how well this works for other encoding, but this solved this same problem i having with views list dropdowns.
Comment #20
ck9 commentedPost 19 thanks that fixed it.
Comment #21
YK85 commentedThis needs to be reviewed and committed to the Content Taxonomy module correct? Thanks
Comment #22
xjmNeed a working patch with the change in #19 to test.
Comment #23
mstrelan commentedPatch of #19
Comment #24
YK85 commentedThank you for the patch!
Comment #25
halmsx commentedsorry, i dont know ho to create a patch. thanks =)
Comment #26
xjmApplying patches: http://drupal.org/patch/apply
Creating patches: http://drupal.org/patch/create
Comment #27
jrockowitz commentedPatch #23 works fine for me. Thanks.
Comment #28
aristeides commentedtested and confirmed, this should definitely be committed!!
Comment #29
Josh Benner commentedPatch in #23 fixes ampersands, but leaves single quotes encoded. The attached patch is a simple revision to #23 that also decodes single quotes.
Comment #30
alan d. commentedIf I am reading this right, I think that this needs to find out if you need to decode or not. Otherwise, this could open up a security hole for checkboxes / radios [maybe...].
Anyways, this is what I have just implemented. It decides if it is a select list from the filter and passes this on.
I have done this in a way that will not break the existing API, but it makes more sense to just do:
Comment #31
NathanM commentedIs there any chance we could get any of these solutions committed?
Comment #32
marleo commentedWow. Four years and no fix released?
I'm seeing this in Views exposed filter select dropdown.
It only happens with content taxonomy select field. Another vocab as checkboxes doesn't do it in the exposed filter.
Patch from #23 fixed it.
Drupal 6.24
content_taxonomy 6.x-1.0-rc2
views 2.10
Comment #33
JCB commentedI can confirm #23 worked on D6