I have a schema with a multi-valued embedded field, which further have multi-valued text field. Need to loop through the embedded field first and then loop through the multi-valued text field - using XPM tags.
I have read the documentation of XPM where FieldStartMarker fields and its use has been described, but not able to get it work for this scenario.
Component Name: Header
-- Multi-valued Embedded Field: contact_us
---- Single text field: title
---- Multi-valued field: contactnum
Following is the component source XML:
<header>
<contact_details>
<title>Title1:</title>
<contactnum>123456</contactnum>
<contactnum>234567</contactnum>
</contact_details>
<contact_details>
<title>Title2:</title>
<contactnum>123456</contactnum>
<contactnum>234567</contactnum>
</contact_details>
<contact_details>
<title>Title3:</title>
<contactnum>444555</contactnum>
</contact_details>
</header>
For title (single text field), the following markup is working fine:
<!-- TemplateBeginRepeat name="contact_details" -->
@@FieldStartMarker("contact_details[${TemplateRepeatIndex}].title")@@
@@FieldValueStartMarker()@@
@@GetFieldValue("contact_details[${TemplateRepeatIndex}].title", 0)@@
@@FieldValueEndMarker()@@
@@FieldEndMarker()@@
<---- here one more TemplateBeginRepeat, to loop through contactnum, with XPM tags ---->
<!-- TemplateEndRepeat -->
Inner loop i'm trying (which is not working) is as below:
@@FieldStartMarker("contact_details[${TemplateRepeatIndex}].contactnum")@@
<!-- TemplateBeginRepeat name="contact_details[${TemplateRepeatIndex}].contactnum" -->
@@FieldValueStartMarker(TemplateRepeatIndex)@@
@@GetFieldValue("Field.contactnum", TemplateRepeatIndex)@@
@@FieldValueEndMarker()@@
<!-- TemplateEndRepeat -->
@@FieldEndMarker()@@
Please help me out to put correct markups. Here I need to make sure inline editing for "title" field as well, and then the multi-value contactnum field.
EDIT(1):
I have tried putting the following markup:
@@FieldStartMarker("contact_details")@@
<!-- TemplateBeginRepeat name="contact_details" -->
<div>
<h4>
@@FieldStartMarker("contact_details[${TemplateRepeatIndex}].title")@@
@@FieldValueStartMarker()@@
@@GetFieldValue("contact_details[${TemplateRepeatIndex}].title", 0)@@
@@FieldValueEndMarker()@@
@@FieldEndMarker()@@
</h4>
<p>
@@FieldValueStartMarker(TemplateRepeatIndex)@@
@@FieldStartMarker("Field.contactnum")@@
<!-- TemplateBeginRepeat name="Field.contactnum" -->
<span>
@@FieldValueStartMarker(TemplateRepeatIndex)@@
@@GetFieldValue(FieldPath + ".contactnum", TemplateRepeatIndex)@@
@@FieldValueEndMarker()@@
</span>
<!-- TemplateEndRepeat -->
@@FieldEndMarker()@@
@@FieldValueEndMarker()@@
</p>
</div>
<!-- TemplateEndRepeat -->
@@FieldEndMarker()@@
But it is throwing an error:
(80040801) FieldStartMarker does not have a FieldEndMarker.
EDIT(2)
The error has been resolved by putting the following markup.
@@FieldStartMarker("contact_details")@@
<!-- TemplateBeginRepeat name="contact_details" -->
<div>
@@FieldStartMarker("contact_details[${TemplateRepeatIndex}].title")@@
@@FieldValueStartMarker()@@
@@GetFieldValue(FieldPath + ".title", 0)@@
@@FieldValueEndMarker()@@
@@FieldEndMarker()@@
<p>
@@FieldValueStartMarker(TemplateRepeatIndex)@@
@@FieldStartMarker("contact_details[${TemplateRepeatIndex}].contactnum")@@
<!-- TemplateBeginRepeat name="Field.contactnum" -->
<span>
@@FieldValueStartMarker(TemplateRepeatIndex)@@
@@GetFieldValue(FieldPath + ".contactnum", TemplateRepeatIndex)@@
@@FieldValueEndMarker()@@
</span>
<!-- TemplateEndRepeat -->
@@FieldEndMarker()@@
@@FieldValueEndMarker()@@
</p>
</div>
<!-- TemplateEndRepeat -->
@@FieldEndMarker()@@
However, inline editing is still not enabled. Title and contact num are rendering properly, but not editable in XPM.
The following HTML markup is published to the page,
<div>
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:header/custom:contact_details[1]/custom:title[1]"} -->
Customer service:
</span>
<p>
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:header/custom:contact_details[1]"} -->
<span>
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:header/custom:contact_details[1]/custom:contactnum[1]"} -->
(+46) 0123456789
</span>
</span>
<span>
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:header/custom:contact_details[1]/custom:contactnum[2]"} -->
(+46) 0123456789
</span>
</span>
<span>
<span><!-- Start Component Field: {"XPath":"tcm:Content/custom:header/custom:contact_details[1]/custom:contactnum[3]"} -->
(+46) 0123456789
</span>
</span>
</span>
</p>
</div>
Please let me know if I am missing any tag here.
Also, please confirm if the XPath is correct,
"XPath":"tcm:Content/custom:header/custom:contact_details[1]/custom:title[1]"
,