PDA

View Full Version : [FIXED-609] RadioGroup Readonly



maquejp
19 Feb 2010, 5:17 AM
Hi,

I am trying to use the setReadOnyl(true) public method of the Class Ext.form.RadioGroup.
But I am still able to click and change the values (I can select one of the other option)


Within a formpanel


new Ext.form.RadioGroup({id:'TENPERBUDGNOTRECEI',name:'TENPERBUDGNOTRECEI',allowBlank: false,columns: 3,columns: [100, 100, 100],
fieldLabel:'At least 10% of the budget must be allocated to organisations that have not received any funding under the HP of the EC in the past 5 years',
items:[
{boxLabel: 'YES',name:'TENPERBUDGNOTRECEI',inputValue: '1'},
{boxLabel: 'NO',name:'TENPERBUDGNOTRECEI',inputValue: '0'},
{boxLabel: 'N/A',name:'TENPERBUDGNOTRECEI',inputValue: '9'}]})

in the .getForm().load({...success...


if (Ext.getCmp('PERCENTTOTBUDGREQUESTFLAG').getValue() == 'NO') {
Ext.getCmp('TENPERBUDGNOTRECEI').setValue(9);
Ext.getCmp('TENPERBUDGNOTRECEI').setReadOnly(true);
}


The .setDisabled(true) works but the forced value is not sent as the input is disabled...

In advance, thank you

jsakalos
19 Feb 2010, 1:23 PM
Yes, it seems that readOnly option of RadioGroup is ignored (disabled option works). Now, I don't know if readOnly should be supported and is not - that would be Ext bug or if it shouldn't be supported but is documented - that would be documentation bug.

Nevertheless, moving the thread to Bugs forum.

maquejp
21 Feb 2010, 11:16 PM
OK, I will wait for an answer and write at the server side the specific condition (if not passed, force database value)...

Thanks

Jamie Avins
9 Mar 2010, 2:50 PM
[type]: fix
[module]: CheckboxGroup
[id]: #609
[desc]: Fixes #609. CheckboxGroup/RadioGroup will now apply setReadOnly to their child items.

maquejp
11 Mar 2010, 2:31 AM
Is it part of 3.1.2?

Jamie Avins
11 Mar 2010, 10:54 AM
No, this will be in 3.2

maquejp
12 Mar 2010, 12:17 AM
ok, thanks

kpalser
15 Jun 2010, 5:23 AM
Has this definitely been fixed for 3.2.1? I still have the same issue. After I use setReadOnly(true), I can still change the selected radio button:

Ext.getCmp("radiogroup-sexo").setReadOnly(true);



{
xtype: 'radiogroup',
columns: 2,
name:'sexo',
id:'radiogroup-sexo',
items: [
{boxLabel: 'V', name: 'sexo', inputValue:'V'},
{boxLabel: 'H', name: 'sexo', inputValue:'H'}
]
},

evant
15 Jun 2010, 5:51 AM
Browsers don't recognize readOnly on checkboxes/radios. The best you can do is disable them.

dtex-lab
30 Jun 2010, 6:55 AM
Browsers don't recognize readOnly on checkboxes/radios. The best you can do is disable them.
A solution can be into Ext.form.RadioGroup:



bufferChecked : function(){
if(this.readOnly)
{
this.reset();
return false;
}

var out = null;
this.eachItem(function(item){
if(item.checked){
out = item;
return false;
}
});
this.fireEvent('change', this, out);
},


Evant (ExtJS Team), can you check if it is a valid solution also for you and implements it in a next ExtJS Release?

It is working for me.
Ty

dtex-lab
1 Jul 2010, 7:56 AM
Hi
Any comments about my possibile fix for this issue ?
Ty

evant
1 Jul 2010, 8:10 AM
I don't think it's a good idea. Read only checkboxes/radios aren't really a great idea.

dtex-lab
1 Jul 2010, 10:04 PM
Can you explain why you think is not a great idea?
You must think we are creating ERP application and often there are reaonly fields.

I bealieve that a framework like extJS should implements the solution. If the developer decide to use it... ok..
In my mind a RIA framework should also bypass browser limit and implements new features...

ty and bye

evant
1 Jul 2010, 10:29 PM
Well, if I were using a form and I clicked on a checkbox that didn't look like it was disabled and it didn't do anything, I would be mighty confused.

dtex-lab
2 Jul 2010, 1:27 AM
In my cases all reaonly fields have an addition class css in order to show the status... so the same can be for a textfield in your case... in this case you can also set the focus on the field....



{
xtype: 'textfield',
readOnly : true
}


So from your point of view, the readOnly config parameter should be remove from all components...

leolox69
2 Mar 2012, 7:37 PM
A solution can be into Ext.form.RadioGroup:



bufferChecked : function(){
if(this.readOnly)
{
this.reset();
return false;
}

var out = null;
this.eachItem(function(item){
if(item.checked){
out = item;
return false;
}
});
this.fireEvent('change', this, out);
},


Evant (ExtJS Team), can you check if it is a valid solution also for you and implements it in a next ExtJS Release?

It is working for me.
Ty

Hey where did you put this config? In the checkboxgroup/radiogroup configuration? Because there is no bufferChecked config in the docs. I'm using ExtJS 3.4.