PDA

View Full Version : viewing problems in a form



dax
4 Oct 2007, 8:20 AM
Hi!!!

I'm triying to display a form in a dialog window and I get a design error I think and I can't to see my form.

I put the html code :



<div id="capa_form" name="capa_form" style="width:600px;" class="x-form">
<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;">Multi-column and labels top</h3>
<div id="form-ct2">

</div>
</div></div></div>
<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
</div>


And the js code :



var obrirForm = function(){
var dialog;

return {
show: function(){
if(!dialog){
dialog = new Ext.BasicDialog("capa_form", {
autoTabs: false,
width: 500,
height: 300,
shadow: true,
minWidth: 500,
collapsible: false,
modal: false,
minHeight: 300,
proxyDrag: false
});
dialog.addKeyListener(27, dialog.hide, dialog);
dialog.addButton('Aceptar', dialog.hide, dialog);
}
dialog.show();
}
};

var top = new Ext.form.Form({
labelAlign: 'top'
});

top.column(
{width:282}, // precise column sizes or percentages or straight CSS
new Ext.form.TextField({
fieldLabel: 'First Name',
name: 'first',
width:225
}),

new Ext.form.TextField({
fieldLabel: 'Company',
name: 'company',
width:225
})
);

top.column(
{width:272, style:'margin-left:10px', clear:true}, // apply custom css, clear:true means it is the last column
new Ext.form.TextField({
fieldLabel: 'Last Name',
name: 'last',
width:225
}),

new Ext.form.TextField({
fieldLabel: 'Email',
name: 'email',
vtype:'email',
width:225
})
);

top.container({},
new Ext.form.HtmlEditor({
id:'bio',
fieldLabel:'Biography',
width:550,
height:200
})
);

top.addButton('Save');
top.addButton('Cancel');

top.render('form-ct2');
}();

Ext.onReady(function(){
var tb = new Ext.Toolbar('barra_menu', [{
text : 'Archivo',
menu : {
id : 'MenuBasico',
items :
[{
text : 'Ventana',
handler : function(){ finestra.show(); }
}, {
text : 'Modal',
handler : function(){ modal.show(); }
},
'-',
{
text : 'Formulario',
icon : 'list-items.gif',
handler : function(){ obrirForm.show(); }
}]
}
}]);
});


I hope you can understand me.

Bye.

devnull
4 Oct 2007, 9:12 AM
you should build the form inside the "if (!dialog)" block, and then apply the form to the dialog (top.applyTo(dialog)).

dax
5 Oct 2007, 2:06 AM
Thanks devnull for your replay.

I can

dax
5 Oct 2007, 6:30 AM
Any idea??

:(( :(( :(( :((

evilized
5 Oct 2007, 6:56 AM
Hi =)

i've a form in a dialog.... so i can put a bit of my code for u.

[php]var detailDialog = function() {
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';

this.doCancel=function() {
this.dlg.hide();
}

this.doOK=function() {
if(this.form.isValid())
{
this.form.submit({
waitMsg: 'Actualizando la informacion...',
success:function(f,a){
if(a & a.result)
{
alert('informacion actualizada!!!');
this.dlg.hide();
}
}
});
}
}

this.dlg = new Ext.BasicDialog('detail-dlg', {
autoCreate: true,
width: 420,
height: 440,
modal: true,
proxyDrag: true,
shadow: true,
collapsible: false,
resizable: false,
closable: true,
title: 'Informacion detallada del cliente'
});

this.dlg.addButton('Guardar', this.doOK, this);
this.dlg.addButton('Cerrar', this.doCancel, this);

this.form = new Ext.form.Form({
labelAlign: 'left',
labelWidth: 150,
url: 'resources/backend/client.php?do=save',
method: 'post',
buttonAlign: 'left',
baseParams: {
action: 'register'
},
errorReader: new Ext.data.JsonReader(
{
successProperty: 'success',
root: 'errors'
},['id', 'msg']
)
});

this.form.fieldset(
{},

new Ext.form.TextField({
allowBlank:false,
fieldLabel: 'Cedula de identidad',
name: 'c_rut',
readOnly:true,
width:190
}),

new Ext.form.TextField({
allowBlank:false,
fieldLabel: 'Raz

dax
5 Oct 2007, 8:01 AM
Hi evilized!!!

Thanks for your replay. I tried like you tell me but I can't show the form now, I'll continue this weekend. Thanks.

Another question : Eres de habla hispana??

Bye...

evilized
5 Oct 2007, 8:32 AM
Hi evilized!!!

Thanks for your replay. I tried like you tell me but I can't show the form now, I'll continue this weekend. Thanks.

Another question : Eres de habla hispana??

Bye...

si no te funciona entonces, puede que tengas algun problema extra, pues de esa forma yo he echo todos mis formularios en dialogos y funcionan bien.

espero que tengas suerte el fin de semana.

=)