PDA

View Full Version : how to remove a formPanel form Panel



karim480
25 Apr 2008, 12:17 AM
Hi,
I have a panel and i want to show forms on this panel based on menu selection.
But the problem what i am facing is the forms are appending to the panel, not showing one form in panel.

Can anybody suggest me how to show a single form in a panel?( remove the existed forms in panel if any)

Thanks in advance...........

Animal
25 Apr 2008, 12:41 AM
If you want to switch between viewing different Forms within a Panel, then give the containing Panel layout:'card'.

Then use



myContainingPanel.layout.setActiveItem(formYouWantToBecomeVisible);

karim480
25 Apr 2008, 12:58 AM
I did as u said but it is not working

My code is as follows:::;



var pan = new Ext.Panel({
region:'center',
frame:true,
autoScroll:true,
autoHeight : true,
autoDestroy:true,
layout:'card',
id:'kPanel'
});
function onItemCheck(item, checked){
pan.load({
url: "form1.html",
discardUrl: false,
nocache: false,
text: "Loading111...",
timeout: 5,
scripts: true
});
}


function onItemCheck22(item, checked){
pan.load({
url: "form2.html",
discardUrl: false,
nocache: false,
text: "Loading111...",
timeout: 5,
scripts: true
});
}

form1.html...........................



<script>


var simple = new Ext.FormPanel({
labelWidth: 75, // label settings here cascade unless overridden
// url:'save-form.php',
//frame:true,
title: 'Simple Form',
bodyStyle:'padding:5px 5px 0',
width: 350,
defaults: {width: 230},
defaultType: 'textfield',
id:'form11',
items: [{
fieldLabel: 'First Name',
name: 'first',
allowBlank:false
},{
fieldLabel: 'Last Name',
name: 'last'
},{
fieldLabel: 'Company',
name: 'company'
}, {
fieldLabel: 'Email',
name: 'email',
vtype:'email'
}, new Ext.form.TimeField({
fieldLabel: 'Time',
name: 'time',
minValue: '8:00am',
maxValue: '6:00pm'
})
],

buttons: [{
text: 'Save'
},{
text: 'Cancel'
}]
});
simple.render('kPanel');

</script>


Please suggest me