Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: selected option displaying html escaped caracters

fmaeseele pro asked 5 years ago


Hi,When displaying a select control with a pre selected option containing escaped cars, it displays the option "description" with escaped cars although it displays correctly while displaying the list.Sorry for the provided snipped which is in french :-)

Regards

Snipped


fmaeseele pro answered 5 years ago


Hi,

Here is a proposed working fix for next version of JQuery MDB Pro (currently 4.7.1)

MDB.JS 4.7.1 Line 17927: Fix to correctly display text with "& < > or others protected HTML cars."

    this.$nativeSelect.data('select-id', this.uuid);
    this.$selectWrapper.addClass(this.$nativeSelect.attr('class'));
    /* Fix Start */
    var map = { amp: '&', lt: '<', le: '≤', gt: '>', ge: '≥', quot: '"', '#039': "'" };
    var sanitizedLabelHtml = this.$materialSelectInitialOption.replace(/&([^;]+);/g, function (m, c) { return map[c] || '' });
    /* Fix End */
    this.$materialSelect.val(sanitizedLabelHtml);
    this.renderMaterialSelect();
    this.bindEvents();

Hope that helps. Regards François


Bartłomiej Malanowski staff commented 5 years ago

Thank you for the tip! I've added this issue to our bug list so I hope this will be fixed soon


Joe Yong free commented 5 years ago

Hello there, we are still experiencing this bug and we are currently on MDB Pro 4.7.6. Will this be fixed soon? Thank you.


Piotr Glejzer staff commented 5 years ago

We already fix that problem. It will be fixed in 4.7.7 version. Thanks!


Joe Yong free commented 5 years ago

Hello, we updated to the latest 4.8 PRO version, and while selecting it works fine, but after selecting and saving the data, it reverts back to having "&" displayed as &


Piotr Glejzer staff commented 5 years ago

Thanks for a report, I added this to check it. Sorry about that.


Piotr Glejzer staff commented 5 years ago

Hi, may you show me an example of this problem? https://mdbootstrap.com/snippets/



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.6.1
  • Device: PC
  • Browser: Chrome/Edge/Firefox
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes