PDA

View Full Version : Quicktips & validation in panels



Duffman-
27 Apr 2010, 11:15 AM
Hello,

I recently started working on a User Interface using extJS. Everything is going fine but I've ran into a problem I can't seem to solve.
I started out with a panel, containg two formpanels. The validation and quicktips using this architecture was working without any problems, but when I needed to submit the two formPanels at the same time, I ran into a problem.

That's the reason why now I am trying to have a Ext.FormPanel, containg two Ext.Panel-components. This works out fine as well, and when I submit the formPanel, all the fields I need are in the request(so the problem I had before was resolved).
Now a problem occurs when I'm trying to validate the text fields in the Ext.Panels. The Quicktips aren't working as well. I have looked into the Ext.Panel validation and I haven't found a method to validate the panels like I can with the formPanel. If I try to submit the FormPanel that contains the two Panels, it doesn't check the TextFields inside the panel. Is there any way of validating the text fields in a panel as well as making the quicktips work again?


This is the code of the FormPanel:


Ext.QuickTips.init();

Ext.onReady(function(){
var createPractice = new Ext.FormPanel({
headerstyle: 'cursor:pointer',
name:'practiceFormPanel',
title: 'Create a practice',
renderTo: Ext.get("practiceFormPanel"),
collapsible: true,
collapsed:false,
layout:'fit',
buttonAlign: 'left',
border:true,
defaults: {
anchor:'95%',
allowBlank:false,
selectOnFocus:true,
msgTarget: 'side'
},
items:[{
border:false,
items: [generalInformation]
}],
bbar: new Ext.ux.StatusBar({
id: 'statusbar',
defaultText: 'test',
plugins: new Ext.ux.ValidationStatus([
{form:'generalInformation-form'}
]
)
}),
buttons:[
{
text: 'test',
handler: function(){
alert('test'); //just to check whether the function is called.
if(createPractice.getForm().isValid()){
alert('ok');
}else
alert('nok');
// if (generalInformation.getForm().isValid()) {

createPractice.getForm().getEl().dom.action = 'createPractice.do';
createPractice.getForm().getEl().dom.method = 'POST';
createPractice.getForm().submit();
}
}]
})

});
So the function that's behind the button always alerts "ok" because it doesn't validate the fields inside the panels.

Thank you,
Simon