Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tips on form vo binding in flex3 and flex4 approach with two-way binding

 
Brick Riccardi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to Flex/AS and currently working on a Flex3 project. I'm coming over from the Java world of things (server side stuff for this app is in Java/Groovy/Stripes.)
One of the minor annoyances I seem to be running into is in relation to populating a VO from a form. Most of the examples seem to show either creating an identical bindable object definition in mxml or examples like this http://www.johncblandii.com/index.php/2008/06/flex-3-two-way-form-databinding.html that still have you declaring a bunch of bindable properties.

In the web world I can have a simple model declaration on the server side "dog of type Dog" and behind the scenes any modern framework will take of binding the request params correctly to the model object without much effort. It seems like in Flex, a similar type of approach should be available. Maybe something where you could just do...



Even the brief Flex4 examples on two-way binding seem to show examples of setting up two way binding on the fields directly not the whole form to a value object? for example they often show:

<fx:Binding source="fieldA.text" destination="fieldB.text" twoWay="true"/>

Isn't there an easy way to bind the entire form to a value object? I'm sure there is, and I'm just missing it, and most of the examples online don't seem to demonstrate it either. Although, I have seen some examples for Flex4 that do NOT show the above Binding definition and instead just use something like <mx:TextInput id="name" text="@{employee.name}"/> which I'm assuming would handle the two way binding. I could seed the form with one 'employee' and when I'm done and click submit just pass that reference to employee to the service layer.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic