Hello Christian,

that is a well known problem in qooxdoo, or better said was. I fixed that bug 
some time ago to create a way to easily use a deputy in all controllers. Take a 
look at the code to see how it can be done now:
http://tinyurl.com/38b4or4

You can just bind the model property of each list item to a special value in 
your model. That way the used selection of the select box contains these 
deputies and with that, these items go into the form model. 

I hope thats what your looking for,
Martin

P.S. You have to set the delegate before setting the model. Otherwise the 
controller gets the first selection wrong.


Am 09.10.2010 um 13:21 schrieb panyasan:

> 
> 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


------------------------------------------------------------------------------
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