Hi Everybody!
I´ve been really racking my brain with this one…
I have one rich text user input field (field key: descricaoImovel). The saved data of this input field should be displayed in a repeater in the text box named #textdescription.
In addition to that, this text box should be limited to displaying 330 characters.
Objective:
I want the character limitation to work at the same time that the field content is displayed with the desired style (font futura light).
Problem:
I cannot get the text box to be displayed in the desired style. Everything else works fine.
I had to use #textdescription.html instead of #textdescription.text because that was the only way to remove the html tags such as
that for whatever reason were being displayed on the repeater.
I would really appreciate any help or suggestions!!!
Code:
$w.onReady(function () {
$w("#dataset2").onReady( () => {
$w("#repeater1").onItemReady( ($item, itemData, index) => {
$w("#repeater1").forEachItem( ($w) => {
let items = $w("#dataset2").getCurrentItem();
if (items["aluguel"]) { $w("#venda0text").hide(); $w("#totalaluguel0text").show() }
else {$w("#venda0text").show(); $w("#totalaluguel0text").hide() }
//SETTING FONT STYLE
$w("#textdescription").html = '<p class="p1"><span style="color:#858585"><span style="text-align:justify"><span style="font-size:16px"><span style="font-style:normal"><span style="font-weight:300"><span style="font-face:futura">' + $w("#textdescription").text +'</span></span></span></span></span></span></p>'
//Limits characters of text boxes inside repeater
{var Titleitem = itemData.title;
if (Titleitem) {
var shortTitle = Titleitem.substr(0,33);
$item("#texttitle").text = shortTitle + "";
}}
{var EnderecoItem = itemData.enderecoV;
if (EnderecoItem) {
var shortEndereco = EnderecoItem.substr(0,40);
$item("#textaddress").text = shortEndereco + "";
}}
//limits characters and removes html tags
{var DescricaoItem = itemData.descricaoImovel;
if (DescricaoItem) {
let newItem = DescricaoItem.replace("<p></p>", "");
var shortDescription = newItem.substr(0,330);
$item("#textdescription").html = shortDescription + "... ";
}}
});
});
});
});