3

In our project we are using a Schema (FAQ) for frequently asked questions. It has a text field heading (for question) and an embedded field paragraph (for Answer) field.

Below is the DD4T Component Template code that we are using -

<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 padding-right-8 faq-contant">
    <div class="">
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-space">
            <h2>
                <xpm:editable model="${FAQ}" field="heading">
                    <c:out value="${FAQ.heading}" />
                </xpm:editable>
            </h2>
        </div>
    </div>
    <divclass="">
        <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 no-space m_top_22">
            <c:forEach var="paragraph" items="${FAQ.paragraph}" varStatus="status" >
                <xpm:editable model="${FAQ}" field="paragraph" index="${status.count}">
                    <c:out value="${paragraph.content}" escapeXml="false" />
                </xpm:editable>
            </c:forEach>
        </div>
    </div>
    </c:if>

Now when we are accessing that page using Experience Manager, the heading field is working fine but the paragraph is not editable.

The JSON ouput of the page -

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 no-space">
    <h2>                    
        <span><!-- Start Component Field: {
"XPath" : "tcm:Content/custom:FAQ/custom:heading[1]"
} -->
            Put your heading Here                   
        </span>                 
    </h2>               
</div>
<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 no-space m_top_22">
   <span><!-- Start Component Field: {
"XPath" : "tcm:Metadata/custom:Metadata/custom:paragraph[1]/custom:paragraph[1]"
} -->
        Here is the description             
   </span>  
</div>
  • Sayantan, do you also have the JSON output for the paragraph field? Knowing the Xpath can help troubleshoot the field. – Alvin Reyes Jun 12 '15 at 6:04
2
+50

The model name specified under the "xpm:editable" tag was wrong, so it is generating the wrong XPATH for that embedded field.Previously it was pointing to the model for the current schema. Now I have changed the model value and point it to the model used for embedded schema.

Previously the code was -

 <divclass="">
    <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 no-space m_top_22">
        <c:forEach var="paragraph" items="${FAQ.paragraph}" varStatus="status" >
            <xpm:editable model="${FAQ}" field="paragraph" index="${status.count}">
                <c:out value="${paragraph.content}" escapeXml="false" />
            </xpm:editable>
        </c:forEach>
    </div>
</div>

Updated code is -

 <divclass="">
    <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 no-space m_top_22">
        <c:forEach var="paragraph" items="${FAQ.paragraph}" varStatus="status" >
            <xpm:editable model="${paragraph}" field="paragraph" index="${status.count}">
                <c:out value="${paragraph.content}" escapeXml="false" />
            </xpm:editable>
        </c:forEach>
    </div>
</div>

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.