Another quick one here. I’ve been using ExtJS on a new project and I’ve just noticed the default behaviour of the checkboxes in the form is a bit of a pain in the ass for working with server side.
The default behaviour is to post ‘on’ when the checkbox is selected and nothing when its empty (Some will argue like it should do). This is fine if you are just checking this flag, but it’s annoying when you are updating an object and you need to know if the user has removed the checkbox selection and you need to update the object accordingly.
I need this behaviour a lot more than I need the default so if you are in the same boat you just need to override a few config items in the checkbox class.
// We don't want the default 'on' value for submission
// causes grief on the backend.
Ext.override(Ext.form.field.Checkbox, {
inputValue: true,
uncheckedValue: ''
});I find these values work perfect in conjunction with Doctrines ODM mapper for MongoDB.
I have a Override.js file in my project that I place all my overrides in thats loaded globally.
Thats it.
