Hi all,

Certain form fields require their value property to be of a certain type.

EG 
<ul>
<li>TextField -> String</li>
<li> Spinner  -> Integer</li>
</ul>

Setting the value property with a different representation throws a type
error.

EG
<ul>
<li>TextField.setValue(5) does not work</li>
<li>TextField.setValue("5") works</li>
<li>Spinner.setValue("5") does not work</li>
<li>Spinner.setValue(5) works</li>
</ul>

I've found this to be problematic when using data binding as now I need
ensure the model values are the correct type for the appropriate form field.
This feels too coupled and goes against the intentions of my model schema.
Until now I have just ensured all values that are displayed are converted to
a string first - however I started to use the Spinner widget which requires
an Integer so I thought I better post about my experience.

Has anyone else experienced this (or have I got it wrong)?

We can work around this by adding a converter option to the form controller
binding at the point where addTarget is set which would convert the value to
the appropriate type for the corresponding widget if needed.

Another option would be to remove the widget type checking or check to see
if the value can be coerced at the point of type checking.

Thoughts on this?.. I'm happy to raise a ticket if there's a common view to
this post - it's not exactly black and white as to say whether this should
be fixed at the widget layer or binding layer (my view is it should be
coerced at the widget layer).





-- 
View this message in context: 
http://qooxdoo.678.n2.nabble.com/data-types-for-form-fields-and-their-affect-in-data-binding-tp5286833p5286833.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to