BindRef not working for repeatable panels in AEM forms

Avatar

Avatar

rohitn62196663

Avatar

rohitn62196663

rohitn62196663

14-09-2018

I am currently working on forms in AEM 6.3. I have a repeatable panel where customer enters address info. I also have a summary page which shows the summary of the address info. So the address info panel in summary section has the same bind ref as the address info section where the customer enters data. However when customer enters something in address info its not getting reflected in the summary section. If its not a repeatable panel then its working. So does the bind ref wont work for repeatable panels ?

Replies

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

14-09-2018

I Guess this is expected as you do not have a single instance where you can interact and set the values directly. You might have to the use the instances API in InstanceManager to set the field value of  partular instance . The syntax to use the instances API in InstanceManager is:

<panelName>.instanceManager.instances[<instanceNumber>].<fieldname>

For example, you create an adaptive form with a repeatable panel having a text box. When you pre-fill the form with three repeatable text boxes, you need the xml below:

<panel1><textbox1>AA1</panel1></textbox1>

<panel1><textbox1>AA2</panel1></textbox1>

<panel1><textbox1>AA3</panel1></textbox1>

To read AA1 data, specify:

Panel1.instanceManager.instances[0].textbox.value

To read AA2 data, specify:

Panel1.instanceManager.instances[1].textbox.value

Avatar

Avatar

rohitn62196663

Avatar

rohitn62196663

rohitn62196663

20-09-2018

Thanks for your response Mayank.

So if that is the case, then for repeatable panels in order to display the same data in summary either I need to use the calculate event on each form field to display the value in summary or I need to write javascript code in order to update the summary panel whenever there is a change in the form fields.

Bind ref is not going to be helpful for this use case in repeatable panels then.

Avatar

Avatar

Mayank_Gandhi

Employee

Avatar

Mayank_Gandhi

Employee

Mayank_Gandhi
Employee

21-09-2018

You can handle that I guess in code editor pretty well. The above approach seems fine to me,