I'm currently struggling to limit the number of characters displayed in a text box on a database connected repeater, I can't get it working... This is my code, any ideas?
$w.onReady(function () {
$w("#eventphotos").onReady(() => {
let text = $w("#eventphotos").getCurrentItem().unsearchedrepdescrip;
if (text.length > 100) {
text = text.substring(0,97) + '...'; }
$w("#unsearchedrepdescrip").text = text;
});
})
Thank you so much!
No, it's still giving me the error, unfortunately...
Thank you!! It's throwing me this error though...
$w.onReady(function () { $w("#eventphotos").onReady(() => { //change repeater1 to the ID of your repeater $w("#repeater1").forEachItem(($w) => { let text = $w("#eventphotos").getCurrentItem().unsearchedrepdescrip; //now we make text short, modify length as required let shortenedtext = text.slice(0, 10); if (text.length > 100) { //unsearchedrepdescrip is the ID of the text on your repeater, change ID as necessary $w("#unsearchedrepdescrip").text = shortenedtext; } }) }) })
@Tomer (Wix)