3

When trying to figure out an error in Template Builder for EnableInlineEditingUI: Unable to determine the definition for field I realized we simply had the wrong component and schema. But I'm trying to understand why part of this worked (fields display but XPath are missing).

The component template adds inline editing fields using <tcdl:ComponentField> and RenderComponentField() in the following (simplified) DWT:

<tcdl:ComponentField name="BannerImage">
<img tridion:type="Multimedia" alt="" src="@@BannerImage.ID@@">
</tcdl:ComponentField>
...
<h2>@@RenderComponentField("Heading", 0)@@</h2>

Run with the right Component that has BannerImage, we correctly get:

<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:BannerImage[1]"} -->
  <img src="http://domain.com/Preview/8774535d-9fb0-43f7-a867-54674b217d85/image.png"  alt="">
</span>
...
<h2>
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:Description[1]"} -->Some Heading</span></h2>

It also partially worked for the wrong Component and different schema. The XPath's are missing but the fields actually render.

<span><!-- Start Component Field: {"XPath":"[1]"} -->
  <img src="http://domain.com/Preview/dfc9a7e4-14c6-4a51-908b-3a77e13f518a/image.png"  alt="">
</span>
...
<h2>
<span><!-- Start Component Field: {"XPath":"[1]"} -->Some Heading</span>
</h2>

Template builder shows (as expected since it's a different component):

EnableInlineEditingUI: Unable to determine the definition for field "BannerImage"

I think the fields display because the modular template adds both Components (with different schemas) to the package (each named "Component").

Out of curiosity and to make sure I understand this, how does RenderComponentField() work? Does it match fields in any item named Component in the package?

1 Answer 1

6

It retrieves the first item named Component from the top of the stack. Most likely your "Working" Component is the last one pushed onto the stack and therefore that one is retrieved. If you try swapping around the order of the Components, then you'll end up with and error.

1
  • Ah, nice catch. It was by luck that the "right" component was added to the package. Oops, I'll be sure to review the technical training again. :-) +1 and accepted. Jul 25, 2013 at 20:12

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.