Maxime
5 Aug 2009, 4:17 AM
Hello,
I created an Extjs windows, and i putted a form into it, but i'm not able to submit my form :(
I understood how i can do it with a simple form (in fact with form into an object : var my_form = new Ext.Form ...).
But with my own code, i can't. Can you help me ?
Thanks.
This is my own code:
<script language="JavaScript">
Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif';
Ext.onReady(function(){
Ext.QuickTips.init();
var win = new Ext.Window({
//url: 'movie-form-submit.php',
title: 'Fiche client',
renderTo:Ext.getBody(),
iconCls:'icon-bulb',
width:650,
height:415,
border:false,
layout:'fit',
items:[{
// form as the only item in window
xtype:'form',
url: 'movie-form-submit.php',
standardSubmit: true,
//id:'fiche',
//labelWidth:60,
frame:true,
items:[{
xtype: 'textfield',
fieldLabel: 'Civilité',
name: 'civilite'
},{
xtype: 'textfield',
fieldLabel: 'Nom',
name: 'nom',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Catalogue',
name: 'catalogue'
},{
// column layout with 2 columns
layout:'column',
// defaults for columns
defaults:{
columnWidth:0.5,
layout:'form',
border:false,
xtype:'panel',
bodyStyle:'padding:0 18px 0 0'
},
items:[{
// left column
// defaults for fields
defaults:{anchor:'100%'},
items:[{
xtype: 'label',
fieldLabel: 'Facturation',
name: 'released'
},{
xtype: 'textfield',
fieldLabel: 'Adresse',
name: 'fact_adresse',
allowBlank: false,
},{
xtype: 'textfield',
fieldLabel: 'Adresse (suite)',
name: 'fact_adresse2'
},{
xtype: 'textfield',
fieldLabel: 'Code Postal',
name: 'fact_cp',
allowBlank: false,
vtype: 'alphanum'
},{
xtype: 'textfield',
fieldLabel: 'Ville',
name: 'fact_ville',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Interlocuteur',
name: 'fact_interlocuteur',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Téléphone',
name: 'fact_telephone',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Télécopie',
name: 'fact_fax'
},{
xtype: 'textfield',
fieldLabel: 'Portable',
name: 'fact_portable'
},{
xtype: 'textfield',
fieldLabel: 'Email',
name: 'fact_email',
vtype: 'email'
}]
},{
// right column
// defaults for fields
defaults:{anchor:'100%'},
items:[{
xtype: 'label',
fieldLabel: 'Livraison',
name: 'released'
},{
xtype: 'textfield',
fieldLabel: 'Adresse',
name: 'livr_adresse'
},{
xtype: 'textfield',
fieldLabel: 'Adresse (suite)',
name: 'livr_adresse2'
},{
xtype: 'textfield',
fieldLabel: 'Code Postal',
name: 'livr_cp',
vtype: 'alphanum'
},{
xtype: 'textfield',
fieldLabel: 'Ville',
name: 'livr_ville'
},{
xtype: 'textfield',
fieldLabel: 'Interlocuteur',
name: 'livr_interlocuteur'
},{
xtype: 'textfield',
fieldLabel: 'Téléphone',
name: 'livr_telephone'
},{
xtype: 'textfield',
fieldLabel: 'Télécopie',
name: 'livr_fax'
},{
xtype: 'textfield',
fieldLabel: 'Portable',
name: 'livr_portable'
},{
xtype: 'textfield',
fieldLabel: 'Email',
name: 'livr_email',
vtype: 'email'
}],
buttons: [{
text: 'Enregister',
handler: function(){
//Ext.Msg.alert('Hello', 'Submit');
this.getForm().submit({
success: function(f, a){
Ext.Msg.alert('Enregistrement', 'Fiche sauvegardée');
},
failure: function(f, a){
Ext.Msg.alert('Enregistrement', "Echec de l'enregistrement : " + a.result.erromsg);
}
})
}
}]
}]
}]
}]
});
win.show();
});
</script>
I created an Extjs windows, and i putted a form into it, but i'm not able to submit my form :(
I understood how i can do it with a simple form (in fact with form into an object : var my_form = new Ext.Form ...).
But with my own code, i can't. Can you help me ?
Thanks.
This is my own code:
<script language="JavaScript">
Ext.BLANK_IMAGE_URL = 'extjs/resources/images/default/s.gif';
Ext.onReady(function(){
Ext.QuickTips.init();
var win = new Ext.Window({
//url: 'movie-form-submit.php',
title: 'Fiche client',
renderTo:Ext.getBody(),
iconCls:'icon-bulb',
width:650,
height:415,
border:false,
layout:'fit',
items:[{
// form as the only item in window
xtype:'form',
url: 'movie-form-submit.php',
standardSubmit: true,
//id:'fiche',
//labelWidth:60,
frame:true,
items:[{
xtype: 'textfield',
fieldLabel: 'Civilité',
name: 'civilite'
},{
xtype: 'textfield',
fieldLabel: 'Nom',
name: 'nom',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Catalogue',
name: 'catalogue'
},{
// column layout with 2 columns
layout:'column',
// defaults for columns
defaults:{
columnWidth:0.5,
layout:'form',
border:false,
xtype:'panel',
bodyStyle:'padding:0 18px 0 0'
},
items:[{
// left column
// defaults for fields
defaults:{anchor:'100%'},
items:[{
xtype: 'label',
fieldLabel: 'Facturation',
name: 'released'
},{
xtype: 'textfield',
fieldLabel: 'Adresse',
name: 'fact_adresse',
allowBlank: false,
},{
xtype: 'textfield',
fieldLabel: 'Adresse (suite)',
name: 'fact_adresse2'
},{
xtype: 'textfield',
fieldLabel: 'Code Postal',
name: 'fact_cp',
allowBlank: false,
vtype: 'alphanum'
},{
xtype: 'textfield',
fieldLabel: 'Ville',
name: 'fact_ville',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Interlocuteur',
name: 'fact_interlocuteur',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Téléphone',
name: 'fact_telephone',
allowBlank: false
},{
xtype: 'textfield',
fieldLabel: 'Télécopie',
name: 'fact_fax'
},{
xtype: 'textfield',
fieldLabel: 'Portable',
name: 'fact_portable'
},{
xtype: 'textfield',
fieldLabel: 'Email',
name: 'fact_email',
vtype: 'email'
}]
},{
// right column
// defaults for fields
defaults:{anchor:'100%'},
items:[{
xtype: 'label',
fieldLabel: 'Livraison',
name: 'released'
},{
xtype: 'textfield',
fieldLabel: 'Adresse',
name: 'livr_adresse'
},{
xtype: 'textfield',
fieldLabel: 'Adresse (suite)',
name: 'livr_adresse2'
},{
xtype: 'textfield',
fieldLabel: 'Code Postal',
name: 'livr_cp',
vtype: 'alphanum'
},{
xtype: 'textfield',
fieldLabel: 'Ville',
name: 'livr_ville'
},{
xtype: 'textfield',
fieldLabel: 'Interlocuteur',
name: 'livr_interlocuteur'
},{
xtype: 'textfield',
fieldLabel: 'Téléphone',
name: 'livr_telephone'
},{
xtype: 'textfield',
fieldLabel: 'Télécopie',
name: 'livr_fax'
},{
xtype: 'textfield',
fieldLabel: 'Portable',
name: 'livr_portable'
},{
xtype: 'textfield',
fieldLabel: 'Email',
name: 'livr_email',
vtype: 'email'
}],
buttons: [{
text: 'Enregister',
handler: function(){
//Ext.Msg.alert('Hello', 'Submit');
this.getForm().submit({
success: function(f, a){
Ext.Msg.alert('Enregistrement', 'Fiche sauvegardée');
},
failure: function(f, a){
Ext.Msg.alert('Enregistrement', "Echec de l'enregistrement : " + a.result.erromsg);
}
})
}
}]
}]
}]
}]
});
win.show();
});
</script>