PDA

View Full Version : radiogroup problem



pret
23 Mar 2011, 10:35 AM
Hi all!

I'm working on an ACL form and I'm using radiogroup's in some fields. Using something like this for the form fields:

items: [ {
xtype: 'fieldset',
title: 'Permisos Generales',
width: '95%',
items: [ {
xtype: 'radiogroup',
fieldLabel: 'Acciones',
anchor: '90%',
items: [ {
columnWidth: '.25',
items: [
{ xtype: 'label', text: 'Update', cls:'x-form-check-group-label', anchor:'-15' },
{ boxLabel: 'Inherit', name: 'acl[entityType][currency][actions][EDIT]', inputValue: 'inherit' },
{ boxLabel: 'Allow', name: 'acl[entityType][currency][actions][EDIT]', inputValue: 'allow' },
{ boxLabel: 'Deny', name: 'acl[entityType][currency][actions][EDIT]', inputValue: 'deny' }
]
} ]
} ],

... etc

Now, when I try to select one field, this error appears:

WARNING: Expected ']' to terminate attribute selector but found '['.
ERROR: uncaught exception: Error parsing selector, parsing failed at "]"

And when I try to load the form using something like:

{ success: true, msg: 'Success', data: [ { 'acl[entityType][currency][actions][UPDATE]': 'inherit', 'acl[entityType][currency][actions][UPDATE]': 'inherit' }, (etc) }

This error appers:

WARNING: Expected ']' to terminate attribute selector but found '['.
ERROR: uncaught exception: Error parsing selector, parsing failed at "][value=inherit]"


I tried Firefox 3.6 and Chrome in its latest version.

Does anyone know how to fix this problem?



Thanks in advance :)

pret
23 Mar 2011, 12:13 PM
I've found the problem. In the Radio.js file, on the "setValue" method you have:



setValue : function(v){
var checkEl,
els,
radio;
if (typeof v == 'boolean') {
Ext.form.Radio.superclass.setValue.call(this, v);
} else if (this.rendered) {
checkEl = this.getCheckEl();
radio = checkEl.child('input[name=' + this.el.dom.name + '][value=' + v + ']', true);
if(radio){
Ext.getCmp(radio.id).setValue(true);
}
}
if(this.rendered && this.checked){
checkEl = checkEl || this.getCheckEl();
els = this.getCheckEl().select('input[name=' + this.el.dom.name + ']');
els.each(function(el){
if(el.dom.id != this.id){
Ext.getCmp(el.dom.id).setValue(false);
}
}, this);
}
return this;
},


Changing it to this (note the double quotations added to the selectors):



setValue : function(v){
var checkEl,
els,
radio;
if (typeof v == 'boolean') {
Ext.form.Radio.superclass.setValue.call(this, v);
} else if (this.rendered) {
checkEl = this.getCheckEl();
radio = checkEl.child('input[name="' + this.el.dom.name + '"][value="' + v + '"]', true);
if(radio){
Ext.getCmp(radio.id).setValue(true);
}
}
if(this.rendered && this.checked){
checkEl = checkEl || this.getCheckEl();
els = this.getCheckEl().select('input[name="' + this.el.dom.name + '"]');
els.each(function(el){
if(el.dom.id != this.id){
Ext.getCmp(el.dom.id).setValue(false);
}
}, this);
}
return this;
},


Everything works as expected. Is this a valid fix? if that's the case, where should I report the problem and its possible solution?


Thanks!