PDA

View Full Version : How to prevent cursor in read only fields



ItDepends
8 Dec 2011, 11:45 PM
A have some fields I want to set to read only. I basically want both a textfield and a combobox to look like a displayfield.

When I set the readonly to true on the fields however, the cursor still appears at the right end of the text if I click one of the fields. You can not move the cursor or write anything so that part of it works.

I see that the cursor does not appear if I use the displayfield, tried looking at the source, but to no avail.

Can someone help?

ItDepends
9 Dec 2011, 3:51 AM
Found a solution myself.


status.setReadOnly(true); //removes the dropdown arrow
status.disable(); //removes the cursor
status.inputEl.addCls('disabledField'); //removes the border and background


Css:


.disabledField
{
background: transparent;
border: 0;
}