O'Reilly logo

Agile Enterprise Application Development with Flex by Tony Hillerson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data Forms

In this section, you’ll continue adding components to the enterprise framework. It’s hard to find an enterprise application that does not use forms, which makes the Flex form component a perfect candidate for possible enhancements. Each form has some underlying model object, and the form elements are bound to the data fields in the model. Flex 3 supports only one-way data binding: changes on a form automatically propagate to the fields in the data model. But if you want to update the form when the data model changes, you have to manually program it using the curly braces syntax in one direction and BindingUtils.bindProperty() in another.

Flex 4 introduces a new feature: two-way binding. Add an @ sign to the binding expression (@{expression}) and notifications about data modifications are sent in both directions—from the form to the model and back. Although this helps in basic cases where a text field on the form is bound to a text property in a model object, two-way binding doesn’t have much use if you’d like to use data types other than String.

For example, two-way binding won’t help that much in forms that use the standard Flex <mx:CheckBox> component. What are you going to bind here? The server-side application has to receive 1 if the CheckBox was selected and 0 if not. You can’t just bind its property selected to a numeric data property on the underlying object. To really appreciate two-way binding, you need to use a different set of components, similar to the ones ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required