(Photo: Cool Blue Hive by jurvetson)
In the Setting Property Values in Forms section of the ATG Page Developerâ€™s Guide there are two examples for setting values of array properties in forms.
- Grouped Checkboxes
- Multiple-Selection List Box
Both examples are for a simple form.Â But what if you are generating a form using a ForEach droplet and want to set an array property in each iteration of the loop.Â Fortunately it turns out to be relatively easy.
Hidden or Text Inputs
By the way if you try to set the array element directly using the param:index notation as in the following example it will not work.
When submitting the above form you will get this exception.
atg.droplet.DropletException: Can't set an element of the array property without a set
(int index, Object value) method.
The exception message is a red herring, there is no way you can set the element of an array property no matter what kind of set method you create.Â Trust me, I spent many hours delving into the ATG code to verify this. 🙂