8

I am trying to edit the content of a page using experience manager in Tridion2013 SP1 for a DD4T site. When I click on the rich text box, Content from the textbox disappears at sudden. I have checked the markup for the page which looks fine. I am using the same DD4T view and same CP on a different page for which site edit is working.

<section class="centerCol">
<!-- Start Component Presentation: {"ComponentID" : "tcm:33-1738", "ComponentModified" : "2014-05-21T20:28:56", "ComponentTemplateID" : "tcm:33-1688-32", "ComponentTemplateModified" : "2014-05-07T19:48:12", "IsRepositoryPublished" : false} -->
<article>
<!-- Start Component Field: {"XPath":"tcm:Content/custom:GeneralContent/custom:BodyText[1]"} --><p xmlns="http://www.w3.org/1999/xhtml"><span style="font-size: 16pt;">
Editing Works for this text</span></p><p xmlns="http://www.w3.org/1999/xhtml"><span style="font-size: 16pt;">Editing Works for this text</span></p>
</article>



<!-- Start Component Presentation: {"ComponentID" : "tcm:33-1740", "ComponentModified" : "2014-05-12T18:08:57", "ComponentTemplateID" : "tcm:33-1686-32", "ComponentTemplateModified" : "2014-05-07T19:47:57", "IsRepositoryPublished" : false} -->
<article class="contentWithImage ">
<hgroup>
  <h2><!-- Start Component Field: {"XPath":"tcm:Content/custom:GeneralContentWithImage/custom:Header[1]"} -->Editing does not Works for this text</h2>
</hgroup>

<span>
    <p xmlns="http://www.w3.org/1999/xhtml">Editing does not Works for this text</p>
     <!-- Start Component Field: {"XPath":"tcm:Content/custom:GeneralContentWithImage/custom:BodyText[1]"} -->
</span>
</article>

</section>
5
  • Please share the relevant markup. What may look fine to you, may allow others to understand why you're getting the behavior that you do. Aug 4, 2014 at 11:17
  • And if you open the component in form view, do you see the text?
    – Nuno Linhares
    Aug 4, 2014 at 11:48
  • yes, it is visible in form but when I click on the area it just disappears. Aug 4, 2014 at 12:16
  • Are you sure that you're rendering a Component field in your CP that contains a value? Aug 4, 2014 at 12:18
  • 2
    If you are "using the same DD4T view and same CP on different page for which site edit is working.." then this must be style or content related? Can you confirm the HTML/Class structure is the same using developer tools - also confirm if the content is still in the DOM etc. Aug 4, 2014 at 19:33

2 Answers 2

5

The second field's siteedit markup should be rendered before the field, not after. Try changing your dd4t view so that the output is like this:

<span>
<!-- Start Component Field: {"XPath":"tcm:Content/custom:GeneralContentWithImage/custom:BodyText[1]"} -->
    <p xmlns="http://www.w3.org/1999/xhtml">Here is some text</p>
</span>
2
  • Hi Nikoli,I have changed the view and Output is now looking as you have mentioned but still facing the same issue. Aug 4, 2014 at 12:36
  • Issue has now been resolved. I was using @Html.SiteEditComponentPresentation(Model) outside of <article> tag in the View.As per experience manager any @Html.SiteEdit code should be inside HTML tag. Aug 5, 2014 at 9:22
5

Issue has now been resolved. I was using @Html.SiteEditComponentPresentation(Model) outside of <article> tag in the View.As per experience manager any @Html.SiteEdit code should be inside HTML tag.

<article>
@Html.SiteEditComponentPresentation(Model)
@if (Header != String.Empty) {
    <h2>
    @Html.SiteEditField(Model.Component,Model.Component.Fields["Header"])
   @Header</h2>
}
@if (SubHeader != String.Empty) {
    <h3>@Html.SiteEditField(Model.Component,Model.Component.Fields["SubHeader"])@SubHeader</h3>
}
@if (BodyText != String.Empty) {

  <div>  @Html.SiteEditField(Model.Component,Model.Component.Fields["BodyText"])@Html.Raw(BodyText)</div>
}
</article>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.