forms - Flex - How to bind (two-way) an integer to a TextInput Field -
how two-way bind integer input field in flex/fb4? is_admin integer :
<s:textinput id="textuserisadmin" text="@{user.is_admin}" width="5"/> i receive:
1067: implicit coercion of value of type string unrelated type int. is there different input type, or have bind different way?
short answer, can't 2 way binding when trying change nature of object you're binding. have same or won't work. said, there workaround:
<s:textinput id="textuserisadmin" text="{user.is_admin}" restrict="0-9" change="user.is_admin = int(textuserisadmin.text)"/> as can see here, i'm binding original value model, when user types change event dispatched , textinput value casted , saved. added 'restrict' numbers can typed in.
Comments
Post a Comment