Hello list,

I am going crazy over this simple use case... I want to include a select box
in a form. The select box is populated with a model using the
qx.data.controller.List. The model is more complex than the examples in the
demo browser, which always only use a label model ["a","b","c"]. My model
uses label and value (the real use case also "icon"):

var data = [ 
    { label: "Please select your gender",   value: null},
    { label: "I'm a man",   value: "male"},
    { label: "I'm a woman", value: "female"},
    { label: "I' won't say", value: "unknown"}
  ];

I need to be able to use a simple scalar value in the form model which gets
read from and saved to the server. Here's the basic code:

http://tinyurl.com/3x44wbr

So if the user selects "I am a woman", the form model should contain
"female", and when the form model is updated to contain "unknown" by the
server, the select box should display "I won't say" automatically.

I have solved this before with all kind of ugly code involving looping
through the list models, but there MUST be a cleaner solution - it works
with the simple label-based list models. I remember something about a
"modelSelection" property or the formModel.addBindings() method - but I am
currently at a loss.

Can someone look at the example and tell me where I got stuck? This is such
a common situation in forms that I must be blind not to get it.

Thanks,

Christian 
-- 
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Binding-a-select-box-with-a-complex-model-to-a-scalar-value-in-a-form-model-tp5617833p5617833.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to