Hi folks,
I've got trouble to use MODx.com.boolean component in CMP. I followed the
Developing an Extra in MODX Revolution tutorial (
http://rtfm.modx.com/display/revolution20/Developing+an+Extra+in+MODX+Revolution) and it works fine but now I want add a combo-boolean to my creating form, values aren't store in database anymore.
Appears that values from combo-boolean are sent as string and not boolean, I think.
Here is the JS part :
...
CustomUrls.window.CreateCustomUrl = function(config) {
config = config || {};
Ext.applyIf(config,{
title: _('customurls.customurl_create')
,url: CustomUrls.config.connectorUrl
,baseParams: {
action: 'mgr/customurl/create'
}
,fields: [{
xtype: 'textfield'
,fieldLabel: _('customurls.pattern')
,name: 'pattern'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: _('customurls.criteria_key')
,name: 'criteria_key'
,anchor: '100%'
},{
xtype: 'textfield'
,fieldLabel: _('customurls.criteria_value')
,name: 'criteria_value'
,anchor: '100%'
},{
xtype: 'modx-combo-usergroup'
,fieldLabel: _('customurls.usergroup')
,name: 'usergroup'
,anchor: '50%'
},{
xtype: 'combo-boolean'
,renderer: 'boolean'
,fieldLabel: _('customurls.uri')
,name: 'uri'
,anchor: '50%'
},{
xtype: 'combo-boolean'
,renderer: 'boolean'
,fieldLabel: _('customurls.override')
,name: 'override'
,anchor: '50%'
},{
xtype: 'combo-boolean'
,renderer: 'boolean'
,fieldLabel: _('customurls.active')
,name: 'active'
,anchor: '50%'
}]
});
CustomUrls.window.CreateCustomUrl.superclass.constructor.call(this,config);
};
Ext.extend(CustomUrls.window.CreateCustomUrl,MODx.Window);
Ext.reg('customurls-window-customurl-create',CustomUrls.window.CreateCustomUrl);
...
Here the processor part :
<?php
class CustomUrlCreateProcessor extends modObjectCreateProcessor {
public $classKey = 'CustomUrl';
public $languageTopics = array('customurls:default');
public $objectType = 'customurls.customurl';
}
return 'CustomUrlCreateProcessor';
And here the xpdo schema :
<?xml version="1.0" encoding="UTF-8"?>
<model package="customurls" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" phpdoc-package="customurls" phpdoc-subpackage="model">
<object class="CustomUrl" table="customurls" extends="xPDOSimpleObject">
<field key="id" dbtype="int" precision="11" phptype="integer" null="false" index="pk" generated="native" />
<field key="pattern" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<field key="criteria_key" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<field key="criteria_value" dbtype="varchar" precision="255" phptype="string" null="false" default="" />
<field key="usergroup" dbtype="int" precision="11" attributes="unsigned" phptype="integer" null="false" default="0" />
<field key="uri" dbtype="tinyint" precision="1" attributes="unsigned" phptype="boolean" null="false" default="1" />
<field key="override" dbtype="tinyint" precision="1" attributes="unsigned" phptype="boolean" null="false" default="1" />
<field key="active" dbtype="tinyint" precision="1" attributes="unsigned" phptype="boolean" null="false" default="1" />
</object>
</model>
Have I to test and convert manually returned values to booleans before save ? Or is there another way to do ?
Thanks