On Fri, 2003-11-21 at 10:31, Danny Bols wrote:
> 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");
> }

Well, if you would have read the javadoc of that class and method ...

Anyway, this code changed recently, if you update to current CVS you
should be able to make it work with something like this:

selectionList.addItem("AL", new
Packages.org.apache.cocoon.woody.util.StringMessage("Alabama"));

Though before making usage of that class in this way completely safe,
some other things might be needed (like checking the type of the first
argument).

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]

Reply via email to