Link is not working for Custom Text Component | Community
Skip to main content
New Participant
February 9, 2016
Solved

Link is not working for Custom Text Component

  • February 9, 2016
  • 8 replies
  • 1587 views

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.

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 smacdonald2008

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.

8 replies

smacdonald2008
smacdonald2008Accepted solution
New Participant
February 14, 2016

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.

New Participant
February 14, 2016

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

Lokesh_Shivalingaiah
New Participant
February 12, 2016

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

smacdonald2008
New Participant
February 12, 2016

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. 

Sunil_Chowdhary
New Participant
February 12, 2016

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.

Jitendra_S_Toma
New Participant
February 10, 2016

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

kautuk_sahni
Employee
February 10, 2016

Hi,

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

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
Lokesh_Shivalingaiah
New Participant
February 9, 2016

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 ?