View Full Version : Custom checkbox value. Ex: "t" for checked, "f" for not checked

15 Aug 2009, 12:32 AM

I would like to make a simple checkbox, but instead of replying with true/false I want to return 't' or 'f', depending of the check state it is in.

How could I do this?

Thanks very much

15 Aug 2009, 12:39 AM
What do you mean "replying with"?

The absence of a value indicates that the box isn't checked.

15 Aug 2009, 12:48 AM
If the checkbox is checked, getValue() should return "t"
If the checkbox is not checked, getValue() should return "f"

15 Aug 2009, 12:54 AM
I use PostgreSQL on the server side, and "t" and "f" are the values for true and false. That's why I need to directly generate the value, when I call store.save();

15 Aug 2009, 4:25 AM
Perhaps a subclass of Ext.form.Checkbox, or maybe a plugin. Ext.form.DualValue or something like that?

onRender, you'd create a <input type="hidden"> by the name specified, and clear the name of the actual Checkbox so that the Checkbox does not get suibmitted.

Maintain the value in that hidden field using the onClick template method to gain control.

There's a principle you could use.