-
13 Jul 2007 8:56 AM #1
Help needed !! Template Form
Help needed !! Template Form
Hi,
I'm building an application for my association and i use ext library since 3 weeks only.
here is my issue :
I have 3 tabs in my main layout. the third one contains in his left panel a grid and a toolbar. when you click on an element in the grid, i create 3 new panels in the right area. these panels contain a toolbar and two forms (the second form is not visible).

I use a template to create my form, then i render the form.
the handler when the button "supprimer" is clicked. It suppress data from my mysql database and remove the div ('contFormuModif') which contains my template for the form. Then i recreate this div and append it into the center region of my Layoutvar t = new Ext.Template(
'<div class="x-box-tl">',
'<div class="x-box-tr">',
'<div class="x-box-tc">',
'</div>',
'</div>',
'</div>',
'<div class="x-box-ml">',
'<div class="x-box-mr">',
'<div class="x-box-mc">',
'<h3 style="margin-bottom:5px;">Modification</h3>',
'<div id="{id}">',
'</div>',
'</div>',
'</div>',
'</div>',
'<div class="x-box-bl">',
'<div class="x-box-br">',
'<div class="x-box-bc">',
'</div>',
'</div>',
'</div>'
);
t.append('contFormuModif', {id:'formuModif'});
formModifClient.render('formuModif');
[CODE]
// handler bouton supprimer
supprimeClient = function(e){
formIdClient.submit({
url: 'suppressionClient.php',
waitMsg: 'Suppression en cours...',
success: function(form, action){
// rafraichit liste des clients
dsListeClients.reload();
Ext.Msg.alert('Confirmation', 'Suppression effectu
-
13 Jul 2007 9:19 AM #2
If you create the same element with the same ID, you're going to have problems. You need to remove the 1st element before recreating, or just hide it and reuse later.
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
15 Jul 2007 9:10 AM #3
But i remove it first
Code:// remove layoutDroite.getRegion('center').remove('contFormuModif'); // div pour le formulaire de modif recreate Ext.DomHelper.append('centreOnglet3', {tag:'div', id:'contFormuModif'}, false); Ext.DomHelper.applyStyles('contFormuModif', {width:'640px', margin:'15px', border:'1px solid #ff0000'}); layoutDroite.getRegion('center').add(new Ext.ContentPanel('contFormuModif'));
-
15 Jul 2007 11:21 AM #4
Look at the rendered HTML in firebug - is that div gone after the remove call?
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
16 Jul 2007 1:55 AM #5
Hi nad thanks for your support.
with this code, the div 'contFormuModif' doesn't exist any more in the dom (i have the confirmation in firebug)
Code:// remove layoutDroite.getRegion('center').remove('contFormuModif');
-
16 Jul 2007 7:19 AM #6
Use ext-all-debug.js to see where the error is occurring. Is it happening when you re-add the CP or when you try to reuse the template to add the form again?
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
21 Jul 2007 1:17 AM #7
Hi, here's the error message that firebug gives to me
ct has no properties
getRawValue()ext-all-debug.js (line 20127)
isValid(true)ext-all-debug.js (line 20029)
(no name)(Object initialConfig=Object fieldLabel=Nom name=nom)ext-all-debug.js (line 21977)
each(function(), undefined)ext-all-debug.js (line 5770)
bindHandler()ext-all-debug.js (line 21976)
runTasks()ext-all-debug.js (line 5636)
[Break on this error] this.el = ct.createChild(cfg, position);
the Template seems to work (the div are recreated) but it stops just after he recreates the form.
here's the dom
<div id="contFormuModif" class="x-layout-active-content" style="border: 1px solid rgb(255, 0, 0); margin: 15px; width: 640px;">
<div class="x-box-tl">
<div class="x-box-tr">
<div class="x-box-tc"/>
</div>
</div>
<div class="x-box-ml">
<div class="x-box-mr">
<div class="x-box-mc">
<h3 style="margin-bottom: 5px;">Modification</h3>
<div id="formuModif">
<form id="formModifClient" class="x-form" method="post"/>
</div>
</div>
</div>
</div>
<div class="x-box-bl">
<div class="x-box-br">
<div class="x-box-bc"/>
</div>
</div>
</div>
</div>
-
30 Jul 2007 8:13 AM #8
Hi, i'm back after 2 weeks on hollidays.
the error occurs when the form is rendering :
formModifClient.render('formuModif');
it seem's that he can't recreate the textField 'nom'. any idea ?


Reply With Quote