I still think I am not quite explaining my problem very well.

In a dropdown list of say 3 state codes I wish to default the selected value
to "AK" this being the second value in the list.

Therefore the value of the dropdown list field is defaulted to "AK".

Is this possible within Woody? How do I select a value "in the list" as the
default/selected?

<!-- A typical scenario is where a country dropdown list lists all countries
but defaults to "USA". This is very common behaviour -->

Joe




> 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
> [EMAIL PROTECTED]                          [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to