HTML digital character in dropdown element

georgie

Member
Hello Fabrik team and community!

I plug Fabrik on a external DB, on which I can not handle myself.
I generate a dropdown list from a table of this external DB (database join element).

No problem, but just a display not very beautiful on values containing HTML digital character.
example:
Code:
...'...
It displays as is.

Can Fabrik interpret these characters on the fly in my drop-down lists?

THX

Georges
 
I think you can do it with "eval options" in "Advanced" (not tested)
$opt->text = htmlspecialchars_decode($opt->text);
 
Hello

Thanks, but I can not handle this.
I have tried:
Code:
$opt->text = htmlspecialchars_decode($opt->text);

Without success, no errors but no change.

Georges
 
ok, ' ( = ') is special, you must use
htmlspecialchars_decode($opt->text,ENT_QUOTES)

You can also try
html_entity_decode($opt->text,ENT_QUOTES)
 
Ahhh, yes good!
Indeed it works perfectly in my databasejoin elements.

Please is there an equivalent for a field element, used in a filter list (with dropdown option)?
I have tried some syntaxs, without success.

Georges
 
I've made some changes to the code that should handle this automatically, for both regular dropdown options (the one you are doing yourself at the moment), and for filters (for most element types).

However, I'm not 100% sure I've gotten it right for all filter types. I've written some standard code that handles entities, tags and translation of options. There's some stuff we need to do for some filter types and not others. For example, we have to strip_tags() for dropdowns and multiselect, but not checkbox, etc. And I'm not quite sure why some of the existing code only does htmlspecialchars for dropdowns.

Anyway ... if @georgie and @troester are happy to do some testing on various filter types and entities (quotes, <, >, &) and encoded entities (&quot;, &#39; etc) ... I'll go ahead and commit the changes. I've done some testing, and I'm reasonably sure I haven't made anything worse, lol.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top