Hi Guys,
Rich text in content manager id displaying html on live site.
Pls Help.
Thanks in advance
If you have set the rich text field up in your dataset and connected it to your text box through the dataset connection.
Then it should be displayed as you have set it all up in the rich text field itself, provided you don’t alter any settings in the text box itself in the editor otherwise they will override the dataset field settings.
Thank You so much for the reply.
But text is connected. And the text is set as rich field. I dont know of any altering settings in editor.
Pls Help
Rich text field in a dataset connected to a text box element on your page and tested in preview mode works fine for me.
If your rich text field in your dataset is connected to the text box element on your page, then it should not display anything in the element itself other than the default text from Wix Editor like in the pic from myself above.
You can’t use the rich text field in your dataset and connect it to your page element as well as using text in the text box element at the same time.
Also, note that as you are using show more/show less button or toggle option as shown in this tutorial here.
https://support.wix.com/en/article/corvid-tutorial-creating-a-show-more-link
Note that as you are using the dynamic option of this tutorial as you are using text from a dataset, rather than the static option of simply adding the full text in the box itself.
Then this will explain why the full html settings are being displayed in the text box itself as when you use this tutorial and use the dynamic option, the code is taking ALL the code from the text field.
So, regardless of which field you use, text or rich text field, it will simply take the field as text and so it will also include the rich text settings as part of that text.
If you want to use rich text in that tutorial then you will need to change the code from text to html to suit your needs.
https://support.wix.com/en/article/corvid-about-formatting-text-elements
Finally, note that you don’t need the two fields for the short and full text, it only needs to be the one field as per the tutorial and code below marked in red.
$w("#dynamicDataset").onReady(function () {
// how many characters to include in the shortened version
const shortTextLength = 40;
// set the fullText variable to be the text from the collection
fullText = $w('#dynamicDataset').getCurrentItem().textField;
// if no text to display, collapse the text element and the button
if (!fullText) {
$w('#myTextElement').collapse();
$w('#myButton').collapse();
} else {
// if the text has fewer or the same number of characters as shortTextLength characters, display it as is and collapse the "Show More" button
if (fullText.length <= shortTextLength) {
$w('#myTextElement').text = fullText;
$w('#myButton').collapse();
} else {
// create the shortened version of the text and display it in the text element
shortText = fullText.substr(0, shortTextLength) + "...";
$w('#myTextElement').text = shortText;
}
}
});
Problem is solved now. Thank you so much for the help.