Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

tagfield and special characters


Go to End


4 Posts   1288 Views

Avatar
dacar

Community Member, 173 Posts

15 May 2010 at 1:03am

Edited: 15/05/2010 1:05am

Hi,

If you use tagfield and receive data with special characters from DB then jquery.tags.js will return the html entities. Is there a way to stop that? How can i get the UTF-8 Text from my DB field to the inner HTML input field? I have tried a .replace on line 126 jquery.tags.js but without success.

How can i get back a plain "&"???

                        for (i = 0; i < matches.length; i++) {
                            html += '<' + settings.tagWrap + ' class="_tag_suggestion">' + matches + '</' + settings.tagWrap + '>';
                        }

Can anybody help?

Avatar
dacar

Community Member, 173 Posts

26 May 2010 at 2:47am

Hi, problem still not solved, yet.

In DB the field i am querying has got the Value "Carsten & Carsten".
But the following line from jquery.tags.js returns "Carsten &amp; Carsten".

html += '<' + settings.tagWrap + ' class="_tag_suggestion">' + matches + '</' + settings.tagWrap + '>';

Has anybody an idea?

Avatar
dacar

Community Member, 173 Posts

16 September 2010 at 1:26am

still not solved. can anybod help?

Avatar
dacar

Community Member, 173 Posts

16 September 2010 at 2:45am

I have just put the following code to line 279 of jquery.tags.js

 // replace with jQuery version
            tagMatches = $(tagMatches).click(function (ev) {
                if (ev.target.nodeName.toUpperCase() == settings.tagWrap.toUpperCase() && $(ev.target).is('._tag_suggestion')) {
                    chooseTag(ev.target.innerHTML.replace(/&amp;/g, "&"));
					// alert(ev.target.innerHTML.replace(/&amp;/g, "&"));
                }                
            }).addClass(settings.matchClass);

seems to be working... ;-)