Hey all,

As always, please refer me to previous posts or documentation if this
has been addressed elsewhere. I've searched quite a bit but to my
surprise have not found this topic addressed...

Our Flex application performs a lot of standard CRUD-style operations:
get a list of things, edit one or more, save changes,...

Our forms have TextInput, DateField, ComboBox and CheckBox fields, some
of which, like ComboBox and CheckBox have options populated by
DataProviders.

I'm looking for 'the right way' to:
1. populate form options from dataproviders
2. set field values bound to a backing object

Seems pretty straightforward, right?

I've been having problems figuring out the right way to have a ComboBox
default to the value set in the backing object. 

In the web world, I am used to frameworks that take care of setting form
control settings to values of the object/s backing the form. I have not
figured out how to do this in Flex without writing code for each
ComboBox/RadioButtonGroup,...

Am I missing something in Flex or does someone on this list have a
recommended approach for accomplishing this?

Here's a simple example of what I am trying to do. Is there an attribute
for the ComboBox that I can set that will cause the right item to be
selected in the list. 'text' obviously is not it.


<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>

<mx:Model id="users">
<user>
<id>1</id>
<name>Alex</name>
</user>
<user>
<id>2</id>
<name>Don</name>
</user>
<user>
<id>3</id>
<name>Alon</name>
</user>
</mx:Model>

<mx:Model id="editableModel">
<name>Thing</name>
<owner>
<id>3</id>
<name>Alon</name>
</owner>
<user>
<id>2</id>
<name>Don</name>
</user>
</mx:Model>

<mx:Form>

<mx:FormItem label="Name" width="100%">
<mx:TextInput text="{ editableModel.name }" />
</mx:FormItem>
<mx:FormItem label="Owner" width="100%">
<mx:ComboBox text="{ editableModel.owner.name }" labelField="name"
>
<mx:dataProvider>{ users.user }</mx:dataProvider>
</mx:ComboBox>
</mx:FormItem>

</mx:Form>

</mx:Application>


Thanks,

Alon
[EMAIL PROTECTED]


Reply via email to