1

We have a requirement to add HTML in multi-line text field. For example, content author can add a Bold text in the field-

"test <b>sample text<b>"

now we are having an issue in experience editor and it is behaving strange on the different hosting environment. On Local environment it stripping the HTML Tags and on PROD it encoding the HTML tags when editing from Experience Editor.

I did try following setting -

<setting name="Rendering.HtmlEncodedFieldTypes" value="text|single-line text|multi-line text" />

but no luck, FYI it is working fine for single-line text control and I am not using any ORM.

 @if (isExperienceEditor)
 {
      @Html.Sitecore().Field(_HoverImageCallout.Fields.HoverText)
 }
 else
 {
      @Html.Raw(Model.Item[_HoverImageCallout.Fields.HoverText])
 }

Image after saving item in experience editor -

enter image description here

Sitecore version 9.1.1

  • Please provide more details about your current implementation. – Bartłomiej Mucha Aug 29 '19 at 8:49
  • Multi line text will remove off the Html tags on save, can you please compare out the configs between ur local and production and see the settings difference. – vikash raaj Sep 2 '19 at 18:23
1

There was a defect in prior version of sitecore where multiline text could get modified if html tags are given in it.

In order to fix it sitecore used to provide a patch for it.

https://kb.sitecore.net/articles/148401

https://sitecore.app.box.com/s/m0q3uyjku4emm6y07g6zffc63pby6m6o

However it was recommended to convert multiline text either by single line text or rich text.

In my suggestion it would be better if you can make it Rich text. It will save you to write additional checks as well like "isExperienceEditor" and single line of code can work for both content and experience editor

@Html.Sitecore().Field(_HoverImageCallout.Fields.HoverText)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.