How to extract the values from a TouchUI nested Multifield using HTL or a model, and a comparison of both solutions
Adobe has a helpful tutorial on using a Multifield in a component. This tutorial is good to get the basics but it has two flaws. Firstly, it does not cover nested Multifields and secondly it is actually a bit wrong as it uses a hybrid HTL/Sling Model solution.
In this article, I will show you two ways of using the data from a nested Multifield in your component:
1. Using a java Sling Model
2. Using pure HTL (no model at all)
Creating the edit dialog
Whichever solution you wish to use, you will need a basic component with nested Multifield cq:dialog. So let’s create that now.
I will create my component under /apps/demo/components/content/demo. For now let’s just give it a very simple demo.html file: