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 10/03/2011, 11h24   #1
Candidat au titre de Membre du Club
 
Inscription : février 2009
Messages : 21
Détails du profil
Informations forums :
Inscription : février 2009
Messages : 21
Points : 11
Points : 11
Par défaut CheckBoxGroup: recupérer la valeur d'une case cochée

Bonjour,

J'arrive à récupérer via php les infos de mon formulaire (radiobutton, textfield ou liste déroulante), mais j'ai un soucis pour les checkboxgroup

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
var dispos = new Ext.form.CheckboxGroup(
	{
            xtype: 'checkboxgroup',
            itemCls: 'x-check-group-alt',
            //fieldLabel: 'Custom Layout<br />(w/ validation)',
            allowBlank: false,
            anchor: '95%',
            items: [{
                columnWidth: '.16',
                items: [
                    {xtype: 'label', text: 'Lundi', cls:'lundi-group', anchor:'-15'},
                    {boxLabel: '8h-10h', name: 'l_8_10'},
                    {boxLabel: '10h-12h', name: 'l_10_12'},
		    {boxLabel: '12h-14h', name: 'l_12_14'},
		    {boxLabel: '14h-16h', name: 'l_14_16'},
		    {boxLabel: '16h-18h', name: 'l_16_18'}
                ]
            },{
                columnWidth: '.16',
                items: [
                    {xtype: 'label', text: 'Mardi', cls:'mardi-group', anchor:'-15'},
                    {boxLabel: '8h-10h', name: 'cb-cust-6'},
                    {boxLabel: '10h-12h', name: 'cb-cust-7'},
		    {boxLabel: '12h-14h', name: 'cb-cust-8'},
	       	    {boxLabel: '14h-16h', name: 'cb-cust-9'},
		    {boxLabel: '16h-18h', name: 'cb-cust-10'}
                ]
            },{
                columnWidth: '.16',
                items: [
                    {xtype: 'label', text: 'Mercredi', cls:'mercredi-group', anchor:'-15'},
                    {boxLabel: '8h-10h', name: 'cb-cust-11'},
                    {boxLabel: '10h-12h', name: 'cb-cust-12'},
		    {boxLabel: '12h-14h', name: 'cb-cust-13'},
		    {boxLabel: '14h-16h', name: 'cb-cust-14'},
		    {boxLabel: '16h-18h', name: 'cb-cust-15'}
                ]
            },{
                columnWidth: '.16',
                items: [
                    {xtype: 'label', text: 'Jeudi', cls:'jeudi-group', anchor:'-15'},
                    {boxLabel: '8h-10h', name: 'cb-cust-16'},
                    {boxLabel: '10h-12h', name: 'cb-cust-17'},
		    {boxLabel: '12h-14h', name: 'cb-cust-18'},
		    {boxLabel: '14h-16h', name: 'cb-cust-19'},
		    {boxLabel: '16h-18h', name: 'cb-cust-20'}
                ]
            },{
                columnWidth: '.16',
                items: [
                    {xtype: 'label', text: 'Vendredi', cls:'vendredi-group', anchor:'-15'},
                    {boxLabel: '8h-10h', name: 'cb-cust-21'},
                    {boxLabel: '10h-12h', name: 'cb-cust-22'},
		    {boxLabel: '12h-14h', name: 'cb-cust-23'},
		    {boxLabel: '14h-16h', name: 'cb-cust-24'},
		    {boxLabel: '16h-18h', name: 'cb-cust-25'}
                ]
            },{
                columnWidth: '.16',
                items: [
                    {xtype: 'label', text: 'Samedi', cls:'samedi-group', anchor:'-15'},
                    {boxLabel: '8h-10h', name: 'cb-cust-26'},
                    {boxLabel: '10h-13h', name: 'cb-cust-27'}
                ]
            }]
        });
Si on prend l'exemple du lundi, comment savoir quelle case a été cochée ?
Si ma case a été cochée, je veux affecter 1 au champ pour stocker dans ma bdd, 0 sinon

Merci d'avance
Alpoids est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 10/03/2011, 18h15   #2
Membre éclairé
 
Avatar de JulienFio
 
Julien Fiorentino
Inscription : novembre 2007
Messages : 201
Détails du profil
Informations personnelles :
Nom : Julien Fiorentino
Âge : 28
Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

Informations forums :
Inscription : novembre 2007
Messages : 201
Points : 336
Points : 336
Pour ceux qui auraient la même interrogation il serait bien que tu postes ta solution. Ayant mit la discussion comme étant Résolue j'imagine que tu en as trouvé une
JulienFio est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/03/2011, 09h39   #3
Candidat au titre de Membre du Club
 
Inscription : février 2009
Messages : 21
Détails du profil
Informations forums :
Inscription : février 2009
Messages : 21
Points : 11
Points : 11
Citation:
Envoyé par JulienFio Voir le message
Pour ceux qui auraient la même interrogation il serait bien que tu postes ta solution. Ayant mit la discussion comme étant Résolue j'imagine que tu en as trouvé une
Oui je comptais le faire hier, j'ai pas eu le temps !

Si on prend l'exemple suivant :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var dispos = new Ext.form.CheckboxGroup(
	{
            xtype: 'checkboxgroup',
            itemCls: 'x-check-group-alt',
            allowBlank: false,
            anchor: '95%',
            items: [{
                columnWidth: '.16',
                items: [
                    {xtype: 'label', text: 'Lundi', cls:'x-form-check-group-label', anchor:'-15'},
                     {boxLabel: '8h-10h',  id: 'l1'},
                     {boxLabel: '10h-12h', id: 'l2'},
		     {boxLabel: '12h-14h', id: 'l3'},
		     {boxLabel: '14h-16h', id: 'l4'},
		     {boxLabel: '16h-18h', id: 'l5'}
                ]
            }]
});
Pour savoir si la case l1 (8h-10h) est cochée par exemple, je stocke son état dans une varable lundi1.

Code :
var lundi1 = Ext.getCmp('l1').getValue();
lundi1 contient true ou false
Cette fonction ne marche que si on utilise un id pour les champs
Alpoids est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 18h32.


 
 
 
 
Partenaires

Hébergement Web