Multi-value field data

Background:I am using CKEditor on an XPage to allow users to create/edit HTML content. The CKEditor also allows the HTML to contain form controls, so I have devised some save code that looks into the param object using param.keySet() and param.get(key), finds any non-system fields that the user has added to their HTML and saves the values of those fields into a document.

The Problem:

Most fields just return a string, so if you do a param.get(), you get a string. If you have a set of checkboxes that use the same field name or a multi-select select list, this returns multiple copies of the field/value pair, which the seems to get condensed by the param, so a param.get() for that field gets an object. The problem is, I don’t know how to access the data in that object. If I just try and plop the object into the document using a doc.replaceItemValue, it errors out saying that the object is null. Is this object an Array, a Vector, or just plain null? Do I need to type the variable first? What do I need to do to access its values?

Subject: Figured it out

The param object contains all the fieldnames and a string representation of the values. If the value is not a string, like a multi-value, that string representation is null. A fuller representation of the data is stored in paramValues, in which each value is an Array.

However, there must be something different about the datatype of the array, because you can’t just write it to a document. I had to create a new array and copy the data from the paramValues value into the array, then store it in the document.