I have a AS3 class Loan that is being fetched from the server and the whole Loan class is marked as [Bindable]
Now in the Form I have a: <mx:TextInput text=”{currenLoan.loanAmount}” />
The problem is that user modifies the text in the textInput, it does not automatically update the variable that the control is bound to. I’m not sure if it is supported by Flex though, as I have this expectation from XForms.
As the solution to the problem I had to define the binding as <mx:Binding source=”{myTextInput.text}” destination=”{currentLoan.loanAmount}” /> So then any changes in the TextInput are being committed to the original loan object.
I wonder if there are any better, elegant solutions to this?
5 Comments
Hi!
And… after you added you removed or you kept both of them? (Do you need both of them for bidirectional databinding?)
Thanks
by
Mmmm… your blog “ate” part of my post… I trying to ask you if you used both “mx:TextInput text=â€{currenLoan.loanAmount}— and “mx:Binding source=â€{myTextInput.text}†destination=â€{currentLoan.loanAmount}— to enable bidirectional binding… or you used only one of them…
Luxspes, I believed I used both to make sure that bidirectional binding works.
The binding should not be bidirectional by default, imagine situations where you need to do some validation on the fields before applying the changes.
just my 50 cents :)
Hi,
Thanks for posting. It actually helps me to solve the issue.
But the way you use the syntax is wrong. According to Flex 3 documentation, the curly bracket “{” and “}” are not needed in the “source” and “destination” declaration.
Regards,
Doug
Post a Comment