Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Link is not working for Custom Text Component

Avatar

Level 4

Dear Team,

I am trying to figure out the link issue in my custom text component. But not able to find out.

When I am creating new link by using my custom text component, then my link is coming in the next line and also it is broken, as shown in below screenshot.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Why are you adding so much logic for the text component. Out of the box text component has this logic: 

<%
%><%@include file="/libs/foundation/global.jsp"%><%
%><cq:text property="text" escapeXml="true"
        placeholder="<%= Placeholder.getDefaultPlaceholder(slingRequest, component, null)%>"/>

 

 

There is something in your custom logic that is affecting the link.  

Why not use the ootb component where the link  functionality works.

View solution in original post

8 Replies

Avatar

Level 10

Are you using OOB RTE or customized ?

also, what is the value stored in the content ? does it include '123'. Also did you try debugging using browser console and see if any of the CSS causing this issue ?

Avatar

Administrator

Hi,

Please check Error logs and browser Console logs to further debug this issue.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 9

Sunita

Whatever text you have authored on the RTE, Can you use the html plugin to view authored text in html format and give me here just for evaluation?.

Why there is an arrow in the text?. 

Jitendra

Avatar

Level 2

For tags apearing in new line:-

Seems like a css issue.

Please inspect the element and check the applied css.

For 123 not appearing in html:-

Check the value saved in node and how the value gets retrieved in jsp.

It should work.

Please let it know if any issue and,  let us know the solution if you already got it.

Avatar

Level 10

I have followed standard AEM coding practice and overlayed the text component and placed under /apps and changed some node props. I have used this new component and tested links: 

The link appears perfect and works: 

So over lay the text component and the link will work. If you do not get this result, something is corrupt on your CQ instance., Try this on a fresh CQ instance in your Dev environment. 

Avatar

Level 10

Can you send us your component package so that we can try look at whats happening

Avatar

Level 4

Dear All,

Thanks a lot for all of your help.

I have given you my component structure, as shown in below image.

Also Kindly find my CSS file for my customapp

Kindly find my text.jsp page.

***************************START TEST.jsp*****************************

<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
%><%@include file="/apps/myprojectfoundation/foundation/global.jsp"
%><%@page import="com.myproject.dfac.sunita.components.text.text.TextPresenter"
%><c:set var="model" value="<%= new TextPresenter().getModelFromRequest(slingRequest) %>"/>

<cog:checkErrors model="${model}" render="${wcmMode.edit || model.valid}">
    <c:choose><c:when test="${model.dto.width > 0}">
        <div class="richtext1 ${model.dto.richtextClass}" style="width:${model.dto.width}px;">
    </c:when><c:otherwise>
        <div class="richtext1 ${model.dto.richtextClass}">
    </c:otherwise></c:choose>
        <c:choose><c:when test="${wcmMode.edit && not model.dto.initialized}">
                <div class="defaultValue defaultText">
                    ${model.dto.text}
                </div>
        </c:when><c:otherwise>
            ${model.dto.text}
        </c:otherwise></c:choose>
        </div>
</cog:checkErrors>

***************************END TEXT.jsp******************************

Kindly let me know if you need anything else.

Thanks,

Sonu

Avatar

Correct answer by
Level 10

Why are you adding so much logic for the text component. Out of the box text component has this logic: 

<%
%><%@include file="/libs/foundation/global.jsp"%><%
%><cq:text property="text" escapeXml="true"
        placeholder="<%= Placeholder.getDefaultPlaceholder(slingRequest, component, null)%>"/>

 

 

There is something in your custom logic that is affecting the link.  

Why not use the ootb component where the link  functionality works.