PDA

View Full Version : [CLOSED][3.0.0] ReadOnly Checkbox



robertoroberto
1 Aug 2009, 11:54 AM
Hi
Also If I create a checkbox with readonly : true, HTML code will have the READONLY attribute, but the checkbox is editale (user can change it)

This is a behaviour of HTML... but I believe that a widget like the one distribute by ExtJS should create the checkbox in the right way in order to avoid user change.

Or I make a mistake create it?

THis is the code I use to create it




new Ext.form.Checkbox(


{
id : "myid",
name : "myname",
fieldLabel : "my checkbox",
checked : true,
readOnly : true,
inputValue : 'true'
});


Any idea?

p.s.: use disable : true is not the solution. Readonly and disable are 2 different behavior. Disable field are not submitted on the server side.

mjlecomte
1 Aug 2009, 3:10 PM
Did this work for you in Ext 2?

robertoroberto
1 Aug 2009, 11:15 PM
I don't know if readonly checkbox with ExtJS 2.x is working or not..
Anyway i'm not interested to ExtJS 2.x
I'm working with ExtJS 3.x

I'm migrating my actual Web Application to WEB 2.0 using ExtJS 3.x
In my "traditional" web application to fix this issue (of HTML), I apply a simple trick:

I added an onClick event setting "this.checked" always to the original value (true or false)

e.g.


onClick="this.checked=false;"




<input type="checkbox" id="FlagPers1" name="FlagPers1" value="true" OnClick="this.checked=false;" class="ABS_FIELD ABS_READONLY_FIELD" >

<input type="checkbox" id="FunctionCreate" name="FunctionCreate" value="true" OnClick="this.checked=true;" checked class="ABS_FIELD ABS_READONLY_FIELD" >


Of couse I can apply this trick to ExtJS checkbox... but I'm wonder that this feature is missing on the standard.
I see that a lot of member (and often also ExtJS team) provide workaround /override to solve very common issue... but at the end this very useful solution will not enter in the standard.. crazy.

this is my extjs fix.. maybe this is not the better way.. and I hope something of this will be included in next fixpack




/*
* This override fix issue related to readonly checkbox to avoid edit it - Begin
*/

/*
* This override fix issue related to readonly checkbox to avoid edit it - Begin
*/
Ext.override(Ext.form.Checkbox, {
onClick: function () {
if (this.readOnly === true) this.el.dom.checked = this.originalValue;
Ext.form.Checkbox.superclass.setValue.apply(this, arguments);
}
});
/*
* This override fix issue related to readonly checkbox to avoid edit it - End
*/


bye

robertoroberto
3 Aug 2009, 3:22 AM
Is this issue accepted by ExtJS team as a bug?
thanks

HyGy
29 Oct 2009, 7:48 AM
Is this issue accepted by ExtJS team as a bug?
thanks

I think this problem is still exists! Is it corrected in the SVN version?

evant
17 Nov 2009, 9:28 PM
Normal HTML doesn't behave in that way, I don't think this is a bug. More info here: http://www.htmlcodetutorial.com/forms/_INPUT_DISABLED.html

Marking as closed.