Expand my Community achievements bar.

SOLVED

String Format Syntax Error

Avatar

Level 4

Actually, I am trying to format the string inside the div and when I implement the string format, I am getting a syntax error.

Error, I am getting.

"org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: Identifier card.html cannot be correctly instantiated by the Use API"

And the code is 

 

title="${item.includeIcon =='true' ? '<div class=\'sec-secondary-headings\'><h3>{0}</h3></div><div  class=\'sec-paragraph\'><div class=\'p3\'>{1}</div> </div> @ format=[item.toolTitle, item.toolDescription]' : ''}"

 

I don't know what I am doing wrong. Could someone help me, please? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

You cannot assign the the html tags value in attribute.

Please check similar thread here https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/tooltip-syntax-error/m-p/4... 



Arun Patidar

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @Ameen_Dev ,

Can you please check error.log? Is there any exception? That helps to tackle issue.

Below is one of the example.

  • format: Concatenates strings.
    Example: ${'Page {0} of {1}' @ format = [1, 10]}
    Displays: Page 1 of 10

Regards,

Santosh

Avatar

Level 4

@SantoshSai My Apology. I forgot to add the exact code. I have modified the code above. Please have a look. And by the way, there is no specific error in the error log.

 

Just getting this - "org.apache.sling.api.SlingException: Cannot get DefaultSlingScript: org.apache.sling.api.resource.ResourceNotFoundException: Resource at '/content/dam/en/error/404' not found: No resource found" 

Avatar

Level 4

@SantoshSai In the generic use case, it's working. In my case, it's not working.

Avatar

Correct answer by
Community Advisor

Hi,

You cannot assign the the html tags value in attribute.

Please check similar thread here https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/tooltip-syntax-error/m-p/4... 



Arun Patidar