View Full Version : Customize output from form elements

18 Mar 2010, 4:08 AM

I've got forms in different views (edit, details).

I want to use the same data for both of them.
Till now the details view disables all Elements, but I want to only output the labels and the values. So I want the form to have different modes.

-> If mode is "detail" I want to render the form values without their (input, ...) elements.
-> I tried to set "element.tpl", but it had no effect.

Does anyone know how I can realize this?


19 Mar 2010, 12:51 AM
I've got an approach, but no complete solution.

Ext.sequence(Ext.form.Field.prototype, 'initComponent', function() {
if (this.editMode)
Ext.apply(this, {
autoCreate: {
getValue: function() {
return this.value;
setValue: function(v) {
this.value = v || "";

this.el.dom.innerHTML = v;

Now I'm getting the values of the fields, but for example combo and date still display their images to choose values.

How can I prevent them from rendering?

Also combobox values are the IDs and not the values (but this should be done very easily, customizing this for combos using this.valueField).

Is there anything else I have to consider?