Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Make repeating subform readOnly

Avatar

Level 2

My form has 8 pages. The first page has basic information including a dropdown list for months of the year. When the user selects the add month button, a new instance of the subform is repeated on the other 7 pages of the form. When a checkbox is selected to "close the month" the fields on all of the pages become read only.

My question is, if the user creates a new month before closing the first month, how can I make all of the fields read only when they go back to close the first month? Right now if they close the first month, then add another month, all of the fields become read only and works fine.

I thought to compare the months on the subforms and if they were equal, make the fields read only but I wasn't able to make that work using this code:

if (addRemSub.projectMonth.rawValue == page2.projectSub.addRemSub.projectMonth.rawValue)

xfa.resolveNode("page2.projectSub.projectMonthSub.projectTable").access = "readOnly";  //the projectTable can be repeated

I also tried comparing the index value of the subforms and if they were equal then lock the fields but that also didn't work.

Can anyone help me with this code?

1 Reply

Avatar

Level 2

Nevermind. I got it to work with the help of the action builder.