[daisy] Strangeness with multivalue-fields
Paul Focke
paul at outerthought.org
Tue Apr 3 01:30:22 CDT 2007
On Tuesday 03 April 2007 01:07, Caleb Callaway wrote:
> Set up a document task with the following Javascript actions:
>
> var document = repository.getDocument(variantKey, true);
> document.setField('Product', new Array("X5"));
> document.save();
>
> It produces the following error:
>
> org.mozilla.javascript.WrappedException: Wrapped
> org.outerj.daisy.repository.DocumentTypeInconsistencyException: The
> value for the multivalue-field "Product" should be an array. (#2)
> I can't find any relevant messages in the log files, and the value for the
> multivalue-field "Product" jolly well is an array. What gives?
The multivalue field expects a java array. What you are providing it with is a
javascript array. To create a java array in javascript you do this :
var stringClass = java.lang.Class.forName("java.lang.String");
var myStringArray = java.lang.reflect.Array.newInstance(stringClass, 5);
Paul
More information about the daisy
mailing list