IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Ext JS / Sencha Discussion :

CheckBoxGroup: recupérer la valeur d'une case cochée


Sujet :

Ext JS / Sencha

  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Février 2009
    Messages
    21
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 21
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  2. #2
    Membre expérimenté Avatar de JulienFio
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    201
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Novembre 2007
    Messages : 201
    Par défaut
    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

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Février 2009
    Messages
    21
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2009
    Messages : 21
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    var lundi1 = Ext.getCmp('l1').getValue();
    lundi1 contient true ou false
    Cette fonction ne marche que si on utilise un id pour les champs

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [AC-2002] Pourquoi ma case à cocher à la valeur -1 une fois cochée?
    Par Subkill dans le forum Access
    Réponses: 4
    Dernier message: 19/05/2009, 11h26
  2. retourner une valeur dans une case coché
    Par ghnawfal dans le forum JSF
    Réponses: 3
    Dernier message: 16/04/2008, 13h58
  3. [VB] Recupéré une propriété d'une case coché au hasrd
    Par tom box dans le forum VB 6 et antérieur
    Réponses: 18
    Dernier message: 14/06/2006, 16h28
  4. [Ajax] Recupérer la valeur d'une liste
    Par Kaimann dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 23/02/2006, 18h22
  5. [VB]comment recupérer la valeur d'une variable ?
    Par budylove dans le forum VB 6 et antérieur
    Réponses: 4
    Dernier message: 20/02/2006, 14h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo