PDA

View Full Version : form field render



mic2100
14 Oct 2009, 9:27 AM
hi,

ive been looking around on the forums for a while but i can't seem to find a solution to my problem. anyway here goes....

I have a form that consists of lots of collapsed fieldsets... if i submit the form without expanding any of the windows it auto passes the validation because none of the fields have been rendered to the form yet. is there a method or attribute i can set that renders the fields wen the form is created?

Thanks

aw1zard2
14 Oct 2009, 10:55 AM
Could you expand the fieldset's first then collapse them? Not sure if this would setup everything for you or not.
Basically I would think hiding the formpanel while rendering with collapse: false. Then after everything is finished collapse them then show the panel.

mic2100
14 Oct 2009, 11:21 AM
i was thinking the same thing collapse it after the form as been created... the fieldset contains a radiogroup and another fieldset which contains 2 textareas (this fieldset is not collapsed).



function comments_fields(field_desc, field_label)
{

var comments = {
xtype: 'fieldset',
title: field_label + ' - Observations & Action Taken/Comment',
autoHeight: true,
layout: 'form',
collapsed: false,
//style: 'padding-top: 55px;',
collapsible: true,
items: [{
xtype: 'textarea',
width: 400,
labelWidth: 150,
fieldLabel: 'Observations',
id: field_desc + '_observations',
listeners: {
'change': { fn: function() { var field = Ext.getCmp("rg-" + field_desc); validate_fieldset_data(field_desc, field_label, field); } }
}
},{
xtype: 'textarea',
width: 400,
labelWidth: 150,
fieldLabel: 'Action Taken/Comment',
id: field_desc + '_actions',
listeners: {
'change': { fn: function() { var field = Ext.getCmp("rg-" + field_desc); validate_fieldset_data(field_desc, field_label, field); } }
}
}]
};

return comments;

}

function radio_option(field_desc, field_label)
{

var radio = {
xtype: 'radiogroup',
fieldLabel: field_label,
width: 590,
hideLabel: true,
style: 'padding-bottom: 0px;',
id: 'rg-' + field_desc,
columns: 6,
items: [
{boxLabel: 'A', name: 'rb-' + field_desc, inputValue: 1},
{boxLabel: 'B', name: 'rb-' + field_desc, inputValue: 2},
{boxLabel: 'C', name: 'rb-' + field_desc, inputValue: 3},
{boxLabel: 'NI', name: 'rb-' + field_desc, inputValue: 4},
{boxLabel: 'N/A', name: 'rb-' + field_desc, inputValue: 5},
{boxLabel: 'C', name: 'rb-' + field_desc, inputValue: 6}
],
listeners: {
change: function(field) { validate_fieldset_data(field_desc, field_label, field); }
}

};

return radio;

}

function main_fieldset(field_desc, field_label, field_css)
{

var fieldset = {
xtype: 'fieldset',
title: field_label + " " + check_icon,
autoHeight: true,
cls: field_css,
id: field_desc + '_fieldset',
layout: 'form',
collapsed: true,
collapsible: true,
items: [radio_option(field_desc, field_label),comments_fields(field_desc, field_label)]
};

return fieldset;

}

//example of function call used inside the items of a form panel
//main_fieldset('demolition', 'Demolition', '')