PDA

View Full Version : Only allow editing on a form when edit button pressed



blomasky
12 May 2014, 10:03 AM
I have a grid, which loads a form with the record detail. I do not want to allow the user to edit any fields, unless they press an "edit" button on the form. Is there an easy way to do this? I do not want to disable the fields, since they then turn grey.

Thanks

Bruce

jsakalos
12 May 2014, 10:28 AM
The easiest way is to make fields disabled and enable them on the click of the button. The appearance of the disabled fields can be controlled by disabledCls (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.field.Text-cfg-disabledCls) config option - just set it to empty string to start.

In real life I would also remove border and background from input field so that it would look like a plain text when disabled.

I any case, this is little coding only and a bit of css-ing.