Hi Everybody!
I have a Rich Text input field in a form, where users can add the description of a property. This input field connects to an also rich text field on my database “Venda”, here called #dataset2. The field key of that field is “descricaoImovel”.
This field is displayed in a text box (“#textdescription”) on the repeater, along with 2 other text boxes. I inserted a code to limit the characters of each of those text boxes following the instructions of the following article of wix: https://support.totallycodable.com/en/article/limit-characters-in-a-repeater-using-wix-code
Problem:
It works fine for the other 2 text boxes. But the one text box that should display the content of the field “descricaoImovel” (“#textdescription”) keeps displaying the text with HTML symbols such as
I also keep getting the error message: “Wix code SDK error: The “onItemReady” function of “repeater1” threw the following error: Cannot read property ‘substr’ of undefined”
I suppose it has something to do with the problem but I have no clue what it could be.
I would really appreciate any help or tips! Thanks a lot in advance
Here is the code:
$w.onReady(function () {
//limit character numer
$w("#dataset2").onReady( () => {
$w("#repeater1").onItemReady( ($item, itemData, index) => {
let theItem = itemData.title;
var shortTitle = theItem.substr(0,23);
$item("#texttitle").text = shortTitle + "";
});
$w("#repeater1").onItemReady( ($item, itemData, index) => {
let theItem = itemData.descricaoImovel;
if (theItem) {
var shortDescription = theItem.substr(0,192);
$item("#textdescription").text = shortDescription + " . . . ";
}
});
$w("#repeater1").onItemReady( ($item, itemData, index) => {
let theItem = itemData.enderecoV;
var shortEndereco = theItem.substr(0,35);
$item("#textaddress").text = shortEndereco + "";
});
});
});