String Format Syntax Error | Community
Skip to main content
Level 4
July 27, 2022
Solved

String Format Syntax Error

  • July 27, 2022
  • 2 replies
  • 1278 views

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? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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/462566#M133514 

2 replies

SantoshSai
Community Advisor
Community Advisor
July 27, 2022

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

Santosh Sai
Ameen_DevAuthor
Level 4
July 27, 2022

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

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
July 27, 2022

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/462566#M133514 

Arun Patidar