PDA

View Full Version : Making a form non - editable



Franzen
10 Aug 2010, 4:19 AM
I have a requirement to toggle a forms edit mode on and off.

Ie. To some users without privilege I want to display the forms contents but not allow them to edit any fields.

I looked at the form setDisabled function and this worked sweetly but dimmed the display of the form whereas I want to maintain the display but just disable the ability to edit any fields.

Appreciated if anyone has a neat solution for this.

Condor
10 Aug 2010, 4:47 AM
So you want:

formPanel.getForm().items.each(function(field){
if(field.setReadOnly){
field.setReadOnly(true);
}
});
(some field types can't be made read-only!)

Franzen
10 Aug 2010, 5:21 AM
Thanks again Condor.

I changed the 'fields' to 'items' and it worked a treat.

Appreciated.