Hello,

when trying to populate a selection list from within flow script I ran into
a problem. The following piece of code did not work:

 function myform(form) {
     var widget = form.form.getWidget("myfield");
     var selectionList = new
Packages.org.apache.cocoon.woody.datatype.StaticSelectionList(widget.getData
type());
     selectionList.addItem("AL", "Alabama");
     selectionList.addItem("AK", "Alaska");
     widget.setSelectionList(selectionList);
     form.showForm("flow/myform.form");
}


Changing the code as folows did make it work
from
     selectionList.addItem("AL", "Alabama");
     selectionList.addItem("AK", "Alaska");
to
     selectionList.addItem("AL", null);
     selectionList.addItem("AK", null);


Analyzing this it looks as if the StaticSelectionList is causing the
problem.
Using a null label bypasses the  "interpreter" code and causes my flowscript
example to work:

            if (label != null) {
                interpreter.recycle();
                interpreter.setContentHandler(contentHandler);
                interpreter.deserialize(label);
            } else {
                contentHandler.characters(stringValue.toCharArray(), 0,
stringValue.length());
            }


Any ideas how to solve this?

--
Danny

Reply via email to