cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Selecting the correct value in a selection-list
Date Mon, 24 Nov 2003 10:39:14 GMT
On Mon, 2003-11-24 at 06:30, Joe Latty wrote:
> I have searched through the archives and docs to no avail.
>  
> In the scenario where I have a selection list built up in javascript
>  
> var states = [
>      { key: "AL", value: "Alabama" },
>      { key: "AK", value: "Alaska" },
>      { key: "WY", value: "Wyoming" }
>  ];
>  
> I pass it into the form:
> form.showForm(uri, { "states" : states });
>  
> and in the field I have the following element:
> <wd:selection-list type="flow-jxpath" list-path="states"
> value-path="key" label-path="value"/>
> 
> How can I select a value eg "AK":
> form.getWidget("myStateDropDown").setValue("AK"); 

hmmm, strange. Maybe it's a problem that the setted value is a
javascript string, so try this:

form.getWidget("myStateDropDown").setValue(new java.lang.String("AK")); 

or alternatively:

form.getModel().myStateDropDown = "AK";

though normally the setValue() call should raise an exception if the
argument is of the wrong type.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message