3

I am facing an issue while adding new value in a multi-valued embedded field in XPM.

In case of adding new value after last value of multi value field, it replaces the last value with new one. For example - if multivalue field has 4 values and new value is added at 5th position then it replaces 4th field with new value.

In case of adding new value in between any existing multi value fields, it replaces the previous value with new one. For example - if multivalue field has 4 values and the new value is added after 3rd position then it replaces 3rd field with new value.

Modification in any existing multivalue field is working fine. I have tried using below XML and markup.

Any pointers will be much appreciated.

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>                           

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()@@

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.