PDA

View Full Version : Request: Checkbox model



timo.nuros
17 Oct 2007, 8:33 AM
Hi,

the ExtJS Checkbox models directly after their HTML paradigm. This causes some problems, especially with serializeForm and AJAX requests, as the Checkbox value will not be sent if the checkbox is unchecked. A solution to this would be a property where the unchecked value can be stored, e.g.:


var o = new Ext.form.Checkbox;
o.uncheckedValue = 'off';
o.value = 'on';

It should be up to the developer whether to use the traditional HTML paradigm or to use the uncheckedValue paradigm; and serializeForm should respect this.

What do you think?

Regards,
Timo

harley.333
17 Oct 2007, 6:33 PM
Personally, I think this is a non-standard and proprietary feature. It's probably easy enough for you to override serializeForm and make it do whatever you want.

timo.nuros
17 Oct 2007, 6:44 PM
It *might* be HTML standard, but it *might* not be the way a developer would expect it. A checkbox is either on or off and the developer must be able to retrieve the state, and not "on" or "unknown" instead or "on", "off" or "unknown".

Also, my suggestion don't break existing application.

aconran
17 Oct 2007, 7:10 PM
serializeForm is implemented at the adapter level of Ext. Therefore it follows the same standards the other libraries follow. You'll notice that serializeForm in each of the bridge files are only a few lines long. I'm not sure why Ext would want to change how forms have always worked.

As harley suggested your best bet would be to override the serializeForm implementation if this is the behavior that you desire. I'm sure others would be interested in your override as this is a topic which has come up before.

Aaron