Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript > Bibliothèques & Frameworks > Ext JS / Sencha
Ext JS / Sencha Ext JS / Sencha Forum d'entraide sur les frameworks Ext JS et Sencha. Avant de poster : FAQ ExtJS / Sencha, Toutes les FAQ JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 14/04/2011, 07h15   #1
Membre du Club
 
Inscription : juillet 2005
Messages : 245
Détails du profil
Informations forums :
Inscription : juillet 2005
Messages : 245
Points : 46
Points : 46
Par défaut envoi d'un mail via un formulaire

Bonjour,

j'ai un formulaire, qui doit me permettre d'envoyer un mail quand je clique sur un bouton, voici mon code :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Ext.ns('PI');
	PI.wContact = Ext.extend(Ext.Window, {
			initComponent : function() {
 
			var contact = {
					xtype:'form'
					,id: 'mail-form'
					,url:'scripts/sendMail.php'
					,frame:true 
					,defaults:{anchor:'95%'} 
					,items:[{
						xtype: 'textfield'
						,id: 'contactEmail'
						,vtype: 'email'
						,fieldLabel: 'Votre e-mail'
						,allowBlank: false
						,msgTarget: 'side'
						,blankText: 'e-mail non valide'
						},
						{
						xtype: 'textfield'
						,id: 'contactObjet'
						,fieldLabel: 'Objet'
						,allowBlank: false
						,msgTarget: 'side'
						},
						{
						xtype: 'textarea'
						,id: 'contactMsg'
						,height: 350
						,hideLabel: true
						,allowBlank: false
						,msgTarget: 'side'
						}
					]
					,buttonAlign: 'center' 
					,buttons: [
						{
						xtype: 'button'
						,text: 'Envoyer'
						,icon: 'img/email_go.png'
						,bubbleEvents: ['envoyer']
						,handler: function(){this.fireEvent('envoyer');}
						},{
						xtype: 'button'
						,text: 'Annuler'
						,icon: 'img/cross.png'
						,bubbleEvents: ['annuler']
						,handler: function(){this.fireEvent('annuler');}
						}
					]
 
			};
 
			var config = {
				id: 'wContact'
				,itemId: 'wContact'
				,width: 750
				,height: 500
				,minWidth: 300
				,minHeight: 200
				,layout: 'fit' 
				,border: false 
				,frame: true 
				,title: 'Contact' 
				,items: [contact]
				}	// fin config
 
 
			// apply config
			Ext.apply(this, Ext.apply(this.initialConfig, config));
 
			// call parent
			PI.wContact.superclass.initComponent.apply(this, arguments);
			this.show();
			}	// fin function initComponent
			,listeners: {
				envoyer : function() {
						Ext.getCmp('mail-form').getForm().submit();
						this.close();
				}
				,annuler : function() {this.close();}
			}
 
	}); 	// fin PI.wContact
 
 
 
	Ext.reg('wContact', PI.wContact);
Quand je clique sur envoyer, la fenetre se ferme bien, mais je ne reçois jamais de mail.
et comment passer les paramètres saisis dans les champs du formulaire au script php ?
le script php d'envoi de mail fonctionne bien quand je le lance seul, je reçois bien un mail.

qu'est ce qui cloche?

Merci,

Nicolas
DiverSIG est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/04/2011, 12h06   #2
Membre du Club
 
Inscription : juillet 2005
Messages : 245
Détails du profil
Informations forums :
Inscription : juillet 2005
Messages : 245
Points : 46
Points : 46
Bon, j'arrive maintenant à envoyer un mail avec ce code :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 
Ext.ns('ObsIUEM');
	ObsIUEM.wContact = Ext.extend(Ext.Window, {
			initComponent : function() {
 
			var contact = new Ext.form.FormPanel({
					xtype:'form'
					,id: 'mail-form'
					,frame:true 
					,monitorValid:true
					,defaults:{anchor:'95%'} 
					,items:[{
						xtype: 'textfield'
						,id: 'contactEmail'
						,vtype: 'email'
						,fieldLabel: 'Votre e-mail'
						,allowBlank: false
						,msgTarget: 'side'
						,blankText: 'e-mail non valide'
						},
						{
						xtype: 'textfield'
						,id: 'contactObjet'
						,fieldLabel: 'Objet'
						,allowBlank: false
						,msgTarget: 'side'
						},
						{
						xtype: 'textarea'
						//xtype: 'htmleditor'
						,id: 'contactMsg'
						,height: 350
						,hideLabel: true
						,allowBlank: false
						,msgTarget: 'side'
						}
					]
					,buttonAlign: 'center' 
					,buttons: [
						{
						xtype: 'button'
						,text: 'Envoyer'
						,icon: 'img/email_go.png'
						,formBind:true
						,bubbleEvents: ['envoyer']
						,handler: function(){this.fireEvent('envoyer');}
						},{
						xtype: 'button'
						,text: 'Annuler'
						,icon: 'img/cross.png'
						,bubbleEvents: ['annuler']
						,handler: function(){this.fireEvent('annuler');}
						}
					]
 
			});
 
			var config = {
				id: 'wContact'
				,itemId: 'wContact'
				,width: 750
				,height: 500
				,minWidth: 300
				,minHeight: 200
				,layout: 'fit' 
				,border: false 
				,frame: true 
				,title: 'Contact' 
				,items: [contact]
				}	// fin config
 
 
			// apply config
			Ext.apply(this, Ext.apply(this.initialConfig, config));
 
			// call parent
			ObsIUEM.wContact.superclass.initComponent.apply(this, arguments);
			this.show();
			}	// fin function initComponent
			,listeners: {
				envoyer : function() {
						Ext.getCmp('mail-form').getForm().submit({
										url: 'scripts/sendMail.php?from='+Ext.getCmp('contactEmail').getValue()+
													'&subject='+Ext.getCmp('contactObjet').getValue()+
													'&msg='+Ext.getCmp('contactMsg').getValue(),
										method:  'POST',
										self: self,
										scope: this});
						this.close();
				}
				,annuler : function() {this.close();}
			}
 
	}); 	// fin ObsIUEM.wContact
 
 
 
	Ext.reg('wContact', ObsIUEM.wContact);

il reste juste une petite chose :
J'ai mis sur mes 3 champs (email, objet, message) la propriété allowBlank=false et la propriété formBind=true sur le bouton Envoyer.
Et donc, mon bouton Envoyer ne devient actif que si mes 3 champs sont remplis.
Mais si je remplace mon champ message (type textarea) par un champ de type htmleditor, la propriété allowBlank n'est pas prise en compte sur ce champ, et donc mon bouton Envoyer devient actif dès que les champs email et objet sont remplis.
Pourquoi?

Merci,

Nico
DiverSIG est déconnecté   Envoyer un message privé Réponse avec citation 10
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 01h02.


 
 
 
 
Partenaires

Hébergement Web