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 :

soumission de formulaire + combobox auto alimentées


Sujet :

Ext JS / Sencha

  1. #1
    Membre à l'essai
    Analyste programmeur
    Inscrit en
    Janvier 2009
    Messages
    21
    Détails du profil
    Informations professionnelles :
    Activité : Analyste programmeur

    Informations forums :
    Inscription : Janvier 2009
    Messages : 21
    Points : 24
    Points
    24
    Par défaut soumission de formulaire + combobox auto alimentées
    Bonjour,

    Alors je pense que je vais poser une question très con, mais tellement que j'arrive pas à mettre la main sur des discussions qui me permettrai d'éviter de poser la question .

    Mon code en construction :
    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
    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
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
     
    <?php
    //quelques déclarations
    $annee = date('Y');
    $mois = date('m');
     
    echo '<h2>Report by project</h2>';
     
    //si le formulaire est soumi on va chercher les info projets
    if(!empty($_POST['selectPj']))
            {
            //inclusion des classes pour générer le tableau
            include('./classes/date.php');
            include('./classes/grid.php');
            include('./classes/projet.php');
            include('./classes/discipline.php');
            }
    else
            {       
            //on créer le formulaire
            echo "<script type='text/javascript'>
            /*!
             * Ext JS Library 3.1.1
             * Copyright(c) 2006-2010 Ext JS, LLC
             * licensing@extjs.com
             * http://www.extjs.com/license
             */
            Ext.onReady(function()
                    {
                    /**
                     * Handler specified for the 'Available' column renderer
                     * @param {Object} value
                     */
                     
                    function formatDate(value)
                            {
                            return value ? value.dateFormat('M d, Y') : '';
                            }
    
                    // shorthand alias
                    var fm = Ext.form;
    
                    //create Data Store for ComboBox and create ComboBox
                    var storeProject = new Ext.data.Store({
                            // destroy the store if the grid is destroyed
                            autoDestroy: true,
                            autoLoad: true,
                            // load remote data using HTTP
                            url: './includes/project_RptPj.php',
    
                            // specify a XmlReader (coincides with the XML Ext.format of the returned data)
                            reader: new Ext.data.XmlReader({
                                    // records will have a 'project' tag
                                    record: 'project',
                                    // use an Array of field definition objects to implicitly create a Record constructor
                                    fields: [
                                            {name: 'projectId'},
                                            {name: 'projectName'}                                   
                                            ]
                                    }),
                            sortInfo: {field:'projectId', direction:'ASC'}
                            });
                            
                    var storeDiscipline = new Ext.data.Store({
                            // destroy the store if the grid is destroyed
                            autoDestroy: true,
                            autoLoad: false,
                            // load remote data using HTTP
                            url: './includes/discipline_RptPj.php',
    
                            // specify a XmlReader (coincides with the XML Ext.format of the returned data)
                            reader: new Ext.data.XmlReader({
                                    // records will have a 'discipline' tag
                                    record: 'discipline',
                                    // use an Array of field definition objects to implicitly create a Record constructor
                                    fields: [
                                            {name: 'disciplineId'},
                                            {name: 'disciplineName'}                                        
                                    ]
                            }),
                            sortInfo: {field:'disciplineId', direction:'ASC'}
                            });                     
    
                    var storeSociete = new Ext.data.Store({
                            // destroy the store if the grid is destroyed
                            autoDestroy: true,
                            autoLoad: false,
                            // load remote data using HTTP
                            url: './includes/societe_RptPj.php',
    
                            // specify a XmlReader (coincides with the XML Ext.format of the returned data)
                            reader: new Ext.data.XmlReader({
                                    // records will have a 'societe' tag
                                    record: 'societe',
                                    // use an Array of field definition objects to implicitly create a Record constructor
                                    fields: [
                                            {name: 'societeId'},
                                            {name: 'societeName'}                                   
                                    ]
                            }),
                            sortInfo: {field:'societeId', direction:'ASC'}
                            });                             
    
                    var comboSociete = new Ext.form.ComboBox({
                            allowBlank: false,
                            lazyRender: true,
                            maxLength: 55,
                            width: 110,                     
                            editable: false,
                            emptyText: 'Select a company',  
                            mode: 'local',
                            triggerAction: 'all',
                            store: storeSociete,
                            valueField: 'societeId',
                            displayField: 'societeId',
                            fieldLabel: 'Company ',
                            name: 'selectSte'       
                            });
                            
                    var comboDiscipline = new Ext.form.ComboBox({
                            allowBlank: false,
                            lazyRender: true,
                            maxLength: 55,
                            width: 110,                     
                            editable: false,
                            emptyText: 'Select a discipline',       
                            mode: 'local',
                            triggerAction: 'all',
                            store: storeDiscipline,
                            valueField: 'disciplineId',
                            displayField: 'disciplineId',
                            fieldLabel: 'Discipline ',
                            name: 'selectDisc',     
                            listeners: {
                               'select' : function(cmb, rec, idx) {
                                       comboSociete.clearValue();
                                       comboSociete.store.load({
                                                    params: {'project': comboProject.getValue(), 'discipline': comboDiscipline.getValue()}
                                                    });                
                                            }
                                    }               
                            });                     
                            
                    var comboProject = new Ext.form.ComboBox({
                            allowBlank: false,
                            lazyRender: true,
                            maxLength: 55,
                            width: 110,             
                            editable: false,
                            emptyText: 'Select a project',          
                            mode: 'local',
                            triggerAction: 'all',
                            store: storeProject,
                            valueField: 'projectId',
                            displayField: 'projectId',
                            fieldLabel: 'Project ',
                            name: 'selectPj',                       
                            listeners: {
                               'select' : function(cmb, rec, idx) {
                                       comboDiscipline.clearValue();
                                       comboDiscipline.store.load({
                                                    params: {'project': comboProject.getValue() }
                                                    });                
                                            }
                                    }               
                            });
    
                    function  fct_submit() {
                            formRptPj.form.submit({
                                    url: './includes/rapport_projet.php',
                                    method: 'POST'
                                    });
                            };
                                    
                    var formRptPj = new Ext.FormPanel({
                            labelWidth: 75, // label settings here cascade unless overridden
                            url:'save-form.php',
                            renderTo:'formRptPj',
                            frame:true,
                            title: 'Report project Form',
                            bodyStyle:'padding:5px 5px 0',
                            width: 350,
                            defaults: {width: 230},
                            defaultType: 'textfield',
    
                            items: [comboProject,comboDiscipline,comboSociete,{            
                                    xtype:'fieldset',
                                    title: 'Month',
                                    collapsible: true,
                                    autoHeight:true,
                                    autoWidth:true,
                                    defaultType: 'textfield',
                                    items :[{
                                            fieldLabel: 'Month ',
                                            name: 'selectMois',
                                            value: '".$annee."-".$mois."'
                                    }]},{
                                    xtype:'fieldset',
                                    title: 'OR During',
                                    collapsible: true,
                                    autoHeight:true,
                                    autoWidth:true,
                                    defaultType: 'textfield',
                                    items :[{
                                            fieldLabel: 'Start date ',
                                            name: 'selectDateDeb',
                                            value: 'yyyy-mm-dd'
                                    },{
                                            fieldLabel: 'End date ',
                                            name: 'selectDateFin',
                                            value: 'yyyy-mm-dd'
                                    }]}
                                    ],
                            buttons: [{
                                    text: 'Validate',
                                    handler : fct_submit
                                    }]
                            });
                            
                    });
            </script>";
            
            //maintenant on s'occupe d'affiche le tout
            echo '<div id="formRptPj"></div>';
            
            }
     
    ?>
    La fonction fct_submit va chercher la page demandé et l'exécuter dans son coin, et me dire le résultat. C'est très utile dans certain cas. Mais la je veux juste faire un formulaire et quand je clic sur "Valider", que ça me renvoi sur cette la page voulu mais qui cette fois affichera un tableau.

    Bonne fin d'après-midi, Merci.

  2. #2
    Membre à l'essai
    Analyste programmeur
    Inscrit en
    Janvier 2009
    Messages
    21
    Détails du profil
    Informations professionnelles :
    Activité : Analyste programmeur

    Informations forums :
    Inscription : Janvier 2009
    Messages : 21
    Points : 24
    Points
    24
    Par défaut
    Je viens de découvrir l'option standardSubmit. Qui aurait résolue mon problème si elle ne m'en posait pas un autre.

    Car en définissant à true, tous mes appels se font en standard(logique), du coup ça renvois la page du store storeProject(la première demandé).

    On peut définir quel appel passer en standard ?

  3. #3
    Membre à l'essai
    Analyste programmeur
    Inscrit en
    Janvier 2009
    Messages
    21
    Détails du profil
    Informations professionnelles :
    Activité : Analyste programmeur

    Informations forums :
    Inscription : Janvier 2009
    Messages : 21
    Points : 24
    Points
    24
    Par défaut
    J'aime bien me faire la conversion et comme la nuit porte conseil, c'est moi qui n'avais pas défini comme il faut les options de mon FormPanel...

    Problème résolu.

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Février 2010
    Messages
    267
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2010
    Messages : 267
    Points : 330
    Points
    330
    Par défaut
    et bien bravo !

    Bonne journée ...

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

Discussions similaires

  1. auto Alimentation d'un formulaire
    Par QAYS dans le forum Langage
    Réponses: 2
    Dernier message: 15/08/2011, 17h38
  2. [VS2005][C#]Formulaire, ComboBox bindings
    Par Oufti dans le forum Windows Forms
    Réponses: 8
    Dernier message: 07/06/2006, 18h14
  3. soumission de formulaire : problème ..
    Par questionneuse dans le forum Général JavaScript
    Réponses: 8
    Dernier message: 05/06/2006, 19h14
  4. Confirm sur une soumission de formulaire
    Par ephemere2 dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 21/04/2006, 08h59
  5. double click pour soumission de formulaires
    Par pram dans le forum XMLRAD
    Réponses: 2
    Dernier message: 16/11/2005, 12h32

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