Hey,

> I'm having some difficulty with the following, probably overlooking something
> (checked manual, forums and API).
> 
> I have a form that I want to use for  filling a database entity. I have
> copied the content of the entity to a model, created a form and a controller
> without problems.
> However, now I am extending the form, replacing a text field with a
> SelectBox to limit the input options. In alle examples I can find,
> SelectBoxes are tied to models that contain an array of options, and the
> SelectBox gets it's own controller next to the overall form controller.
> My question now is, what to add to e.g. this example in order to make the
> SelectBox use an array of options, while the result gets synchronised to a
> string in my model.
> 
> I found these two examples, of which I prefer the second, but I can't get it
> to work in the way I want:
> 
> Should I follow the approach in this demo (using qx.data.controller.Object
> instead of qx.data.controller.Form:
> http://demo.qooxdoo.org/devel/demobrowser/#data~SelectBox.htmlDemo
> 
> or is there a way to integrate the automated model and controller creation
> as in this demo:
> http://demo.qooxdoo.org/devel/demobrowser/#data~FormAndListController.html
> 
> My models looks something like this:
> 
> The overall model bound to the form and it's controller:
> { name: "aname", type: "string" }
> 
> The list of values to be used by the SelectBox:
> [ "string", "int", "boolean", "float", "pwstring", "largestring"]
> 
> So, in the end, I want to end up with the following:
> - on loading the form, the selectbox shows the current value of the model
> - on updating the selectbox, using it's list of options, the type field in
> the model is updated
> - the list of values used by the selectbox is not in the model of the form
> 
> Any ideas, or examples of how this can be done?

You can simply create a new array which contains the options and bind that to 
the list controller used for the select box. Just look at the modified sample 
of the second demo you added:
http://tinyurl.com/a9fhzwe

I hope that helps,
Martin
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to