Hello Derrell,

All model properties don't have the fallback to its value. What is clear is,
that we need to supply a possibility to specify a different model than its
value. But I don't know if we need a fallback to the value / label. All
other widgets not having the model property use the value so you don't run
into that problem. 

The only widgets with the model property which could have that fallback are:

qx.ui.form.RadioButton
qx.ui.menu.RadioButton
qx.ui.form.CheckBox
qx.ui.toolbar.RadioButton

qx.ui.form.ListItem
qx.ui.tree.AbstractTreeItem

The first group could have its value as fallback. So you get 'true' or
'false' as model if no model is specified. But how do we know that no model
is specified? Perhaps someone would like to have null as model? Imagine a
set of radio boxes with the first one showing "no thanks" or anything like
that. 
The same is true for the second group where it becomes the label instead of
the value.
What do you think? I'm not sure which situation is worse. Either you can not
specify null as model or you have no fallback!

Regards,
Martin


Derrell Lipman wrote:
> 
> On Sun, Nov 8, 2009 at 11:39, Guilherme Aiolfi <[email protected]> wrote:
> 
>> Setting rb.setModel("yes"); and rb.setModel("no"); for both radiobuttons
>> solved both problems.
>>
> 
> Ah ha! Thanks!
> 
> Martin, is that supposed to be necessary? When using
> controller=qx.data.controller.Form(null, form)  followed by
> controller.createModel(), it seems that all other form items properly
> assume
> the label to be the value unless specified elsewise. Are radio buttons
> intentionally a special case?
> 
> Derrell
> 
> 
>> On Sun, Nov 8, 2009 at 2:18 PM, Derrell Lipman <
>> [email protected]> wrote:
>>
>>> I have two problems in the following playground app.
>>>
>>> 1. It requires 3 clicks on the "No" radio button to set the radio group
>>> to
>>> No. The first click on No selects Yes! The second click on No focuses
>>> No,
>>> but does not select it. The third click on No finally selects it.
>>>
>>> 2. Once No is finally selected, pressing Submit retrieves null, not Yes
>>> or
>>> No or anything that unambiguously identifies the selection. (I suspect
>>> for
>>> this problem, I'm just doing something incorrectly.)
>>>
>>> Derrell
>>>
>>> // Playground application...
>>>
>>> var form = new qx.ui.form.Form();
>>>
>>> this.model = null;
>>>
>>> var manager = new qx.ui.form.RadioButtonGroup();
>>> manager.getRadioGroup().setAllowEmptySelection(true);
>>>
>>> var rb = new qx.ui.form.RadioButton("Yes");
>>> manager.add(rb);
>>>
>>> rb = new qx.ui.form.RadioButton("No");
>>> manager.add(rb);
>>>
>>> form.add(manager, "Do you have a pet?", null, "q1");
>>>
>>> // Create the Submit button
>>> var submit = new qx.ui.form.Button("Submit");
>>> submit.setWidth(80);
>>> submit.addListener(
>>>   "execute",
>>>   function(e)
>>>   {
>>>     if (form.validate())
>>>     {
>>>       // Serialize the form for submission
>>>       var results = qx.util.Serializer.toUriParameter(this.model);
>>>       alert(results);
>>>     }
>>>     else
>>>     {
>>>       alert("Some required field were not entered.");
>>>     }
>>>   },
>>>   this);
>>> form.addButton(submit);
>>>
>>> // Create the form view and add it to the root
>>> var single = new qx.ui.form.renderer.Single(form);
>>> this.getRoot().add(single);
>>>
>>> // Create data binding
>>> var controller = new qx.data.controller.Form(null, form);
>>> this.model = controller.createModel();
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>>> 30-Day
>>> trial. Simplify your report design, integration and deployment - and
>>> focus
>>> on
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> qooxdoo-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
>> 30-Day
>> trial. Simplify your report design, integration and deployment - and
>> focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>
>>
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day 
> trial. Simplify your report design, integration and deployment - and focus
> on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Problem-with-forms-and-radio-buttons-tp3968702p3985247.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to