<apex:repeat value="{!desLSt}" var="key">
    <div class="col-sm-3 col-xs-6 margin-bottom">
        <a href="upload.html">
            <div class="img-box">
            <a href="/apex/VendorGalleryUpload?fName={!key}" alt="{!key}">
                <apex:image style="height:172px" url="{!URLFOR($Resource.vigorousity_style, 'vigorousity_style/img/Default-Activity-Slider.jpg')}"  rendered="{!IF(actAttMap[key] =='',true,false)}"/>
                <apex:image style="height:172px" url="/servlet/servlet.FileDownload?file={!actAttMap[key][0].ID}"  alt="{!key}"  rendered="{!IF(actAttMap[key]!='',true,false)}"/>
            <div class="all-side-border">
                <div class="img-box-text">
                 // alert('{!key}'.length);
                    <a href="/apex/VendorGalleryUpload?fName={!key}"><strong>{!if(LEN(key)>5,Left(key,5)+'...',key)}</strong></a> // Getting error on this line
                <div class="img-box-text">
                    <strong>{!actAttCountMap[key]} photos</strong>
        <a href="#" class="del-btn" onclick="deleteImage('{!key}')"><I class="fa fa-trash-o"></I></a>

"desLSt" is defined as List of String withing Apex.

  • Please include the error message in the question body. - How to Ask – Dave Humm Aug 12 '16 at 10:22
  • desLSt is list of string or list of sobject? – Ratan Paul Aug 12 '16 at 10:24
  • Can you post your controller code for desLSt or confirm the data type of desLSt ? – highfive Aug 12 '16 at 10:26
  • "desLSt" is defined as List of String withing Apex. – kumar gaurav Aug 12 '16 at 10:45

I'm unable to replicate these results in my developer orgizantion. With the controller code, someone on here might be able to help you more, but without it, I'm unsure this will be resolved.

Ill add the page and controller snippets I used to test this for reference, hopefully you might spot something you did wrong.

Testing Page

<apex:page controller="TestController">

    <apex:repeat value="{!listOfStrings}" var="s">
        <a href="/apex/Somewhere?fName={!s}">
            <strong>{!IF((LEN(s) > 5), LEFT(s, 5) + '...', s)}</strong>
        <br />


Testing Controller

public class TestController {

    public TestController() {}

    public List<String> listOfStrings {
        get {

            List<String> listOfStrings = new List<String>();

            listOfStrings.add('Something Else');

            return listOfStrings;



Correct output (Truncated at 5 chars)

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.