PDA

View Full Version : Submit button inside fieldset does not work



vayumahesh
11 Sep 2008, 5:46 AM
I have a formPanel defined as follows with two fieldsets. I would like to display submit button as part of the first fieldset. The button displays fine but it does not work as submit button.

Also, I am getting error (on load of the form) like 'Line 28890 Object does n't support this property or method' pointing to the code
'if(!f.isValid(true)) {' in ext-all-debug.js.




var selfUpdateBtn = {
text: ' Update',
name: 'UpdateBtn',
tooltip: 'Click here to save changes',
tooltipType: 'qtip',
iconCls: 'save',
formBind: true,
xtype: 'button',
isFormField: true,
type:'submit',
labelSeparator: '',
handler: submitForm
};


var formPanel_self = new Ext.FormPanel({
//config parameters
items: [
{
xtype:'fieldset',
title: 'Course Completion Panel',
autoHeight: true,
items: (classParamAll).concat([eqTrExpChk,engrComments,compStatus,compStatusVal,selfUpdateBtn])
},
{
xtype:'fieldset',
title: 'Course Information',
checkboxToggle:true,
collapsed: false,
autoHeight: true,
items: [courseName,className,classRevisionInfo,classAdditionalInfo,courseDelivery]
}
]
});



However, if I have button defined within FormPanel as below, it works but getting displayed at the bottom of the formPanel in a separate section. How can I have the submit button inside the first fieldset without effecting any other code ?




buttons:
[
{
text: ' Update',
name:'UpdateBtn',
tooltip:'Click here to save changes',
tooltipType :'qtip',
iconCls:'save',
formBind:true,
handler : submitForm
}
]

vayumahesh
11 Sep 2008, 7:59 AM
I moved 'selfUpdateBtn' definition down the 'submitForm' definition and the button started working as submit button.

But it is missing disabled feature on failed validation (Button is still enabled even if form validations failed). I thought formBind: true would make it exactly work like a 'submit' button defined under buttons: in formPanel, but not. What am I missing ?



var submitForm = function() {
var s = formPanel_self.getForm().submit
({
... code ...
});
};

var selfUpdateBtn = {
text: ' Update',
name: 'UpdateBtn',
tooltip: 'Click here to save changes',
tooltipType: 'qtip',
iconCls: 'save',
formBind: true,
xtype: 'button',
handler: submitForm
};