Results 1 to 9 of 9

Thread: textfield missing

  1. #1

    Default textfield missing

    Hi,


    I have 2 windows, which when I call, I lose textfield does not understand why. To be better understood, here is a picture:

    http://img524.imageshack.us/img524/7033/empty.png

    and the code:

    Code:
    var displayAddClient = new Ext.Window({
            title: 'Ajouter un nouveau client',
            id: 'addclient',
            width: 500,
            height: 500,
            items: new Ext.form.FormPanel({
                height: 500,
                items:[{
                    xtype: 'textfield',
                    fieldLabel: 'Nom et Prénom*',
                    id: 'fullName',
                    name: 'fullName',
                    maxLength: 45,
                    allowBlank: false,
                    emptyText: 'Entrez un nom et un prénom',
                    anchor: '100%'
                },{
                    xtype: 'textfield',
                    fieldLabel: 'Société',
                    id: 'society',
                    name: 'society',
                    maxLength: 45,
                    allowBlank: true,
                    emptyText: 'Entrez une société',
                    anchor: '100%'
                },{
                    xtype: 'numberfield',
                    fieldLabel: 'NPA',
                    id: 'zip',
                    name: 'zip',
                    maxLength: 5,
                    allowBlank: true,
                    emptyText: 'Entrez un code postal',
                    anchor: '100%'
                },{
                    xtype: 'textfield',
                    fieldLabel: 'Localité',
                    id: 'localite',
                    name: 'localite',
                    maxLength: 45,
                    allowBlank: true,
                    emptyText: 'Entrez une localité',
                    anchor: '100%'
                },{
                    xtype: 'textfield',
                    fieldLabel: 'Ville',
                    id: 'city',
                    name: 'city',
                    maxLength: 60,
                    allowBlank: true,
                    emptyText: 'Entrez une ville',
                    anchor: '100%'
                },{
                    xtype: 'textfield',
                    fieldLabel: 'Rte',
                    id: 'rte',
                    name: 'rte',
                    maxLength: 60,
                    allowBlank: true,
                    emptyText: 'Entrez une adresse',
                    anchor: '100%'
                },{
                    xtype: 'numberfield',
                    fieldLabel: 'Tél. Prof.',
                    id: 'telprof',
                    name: 'telprof',
                    maxLength: 10,
                    allowBlank: true,
                    emptyText: 'Entrez un téléphone professionnel',
                    anchor: '100%'
                },{
                    xtype: 'numberfield',
                    fieldLabel: 'Tél. Priv.',
                    id: 'telpriv',
                    name: 'telpriv',
                    maxLength: 10,
                    allowBlank: true,
                    emptyText: 'Entrez un téléphone privé',
                    anchor: '100%'
                },{
                    xtype: 'textfield',
                    fieldLabel: 'E-Mail',
                    vtype: 'email',
                    id: 'email',
                    name: 'email',
                    maxLength: 45,
                    allowBlank: true,
                    emptyText: 'Entrez une adresse mail',
                    anchor: '100%'
                }]
            }),
            buttons: [{
                    text: 'Sauvegarder',
                    handler: function(){
                        displayAddClient.items.items[0].getForm().submit({
                            url: '/set/client/updateClient/write/',
                            waitTitle:'Sauvegarde',
                            waitMsg:'Sauvegarde en cours...',
                            success: function(f,a){
                                clientStore.reload(); // reload method of a store, uses last load options
                                displayAddClient.hide(); // hide this windowForm
                            },
                            failure: function(f,a){
                                Ext.Msg.alert('Erreur','Echec de la sauvegarde du nouveau client.');
                            }
                        });
                    }
                },{
                    text: 'Annuler',
                    handler: function(){
                        displayAddClient.hide();
                    }
                }]
            });
        
        var displayAddProject = new Ext.Window({
            title: 'Ajouter un nouveau projet',
            id: 'addproject',
            width: 500,
            height: 500,
            items: new Ext.form.FormPanel({
                height: 500,
                items:[{
                    xtype: 'textfield',
                    pageSize:10,
                    hideTrigger:true,
                    fieldLabel: 'Référence*',
                    id: 'ref',
                    name: 'ref',
                    maxLength: 45,
                    allowBlank: false,
                    emptyText:'Entrez une référence',
                    anchor: '100%'
                },{
                    xtype: 'combo',
                    store: clientStore,
                    displayField:'fullName',
                    name: 'fullName',
                    fieldLabel: 'Client(e)*',
                    emptyText:'Sélectionner un(e) client(e)',
                    typeAhead: true,
                    triggerAction: 'all',
                    selectOnFocus:true,
                    allowBlank: false,
                    mode: 'remote',
                    anchor: '100%'
                },{
                    xtype: 'textfield',
                    pageSize:10,
                    hideTrigger:true,
                    fieldLabel: 'Nom du projet*',
                    id: 'name',
                    name: 'name',
                    maxLength: 45,
                    allowBlank: false,
                    emptyText:'Entrez un nom pour ce projet',
                    anchor: '100%'
                }]
            }),
            buttons: [{
                text: 'Sauvegarder',
                handler: function(){
                    displayAddProject.items.items[0].getForm().submit({
                        url: '/set/project/updateProject/write/',
                        waitTitle:'Sauvegarde',
                        waitMsg:'Sauvegarde en cours...',
                        success: function(f,a){
                            projectStore.reload(); // reload method of a store, uses last load options
                            displayAddProject.hide(); // hide this windowForm
                        },
                        failure: function(f,a){
                            Ext.Msg.alert('Erreur','Echec de la sauvegarde du nouveau projet.');
                        }
                    });
                }
            },{
                text: 'Annuler',
                handler: function(){
                    displayAddProject.hide();
                }
            }]
        });
    thanks for your help

    yannick

  2. #2
    Ext User shibubh's Avatar
    Join Date
    Jul 2007
    Location
    Lamahi,Dang Nepal
    Posts
    449

    Default

    first set the layout:'fit' to window.(i think the problem is not caught by this). and check use firebug to check the dom element of the form. check its exit there or not
    Shibu Bhattarai

    Use JavaScript beautifier to beautify you code http://jsbeautifier.org/

    Code Conventions http://javascript.crockford.com/code.html

    ExtJS Core Manual http://extjs.com/products/extcore/manual/

  3. #3

    Default

    0 error with firebug.

    I do not know why, its working very well before and I myself was not more busy, the check I see his work.

  4. #4

    Default

    I do not think the error comes from the same script, because I was copy / paste one that works in my other script. In other works, and its not here. Is what I can give you the complete code for analysis?

  5. #5

    Default

    up

  6. #6

    Default

    I have found the bug !

    On my code:

    Code:
    var displayProjectPanel = new Ext.form.FormPanel({
    ....
    {
                xtype: 'textfield',
                pageSize: 10,
                hideTrigger: true,
                fieldLabel: 'Référence*',
                id: 'ref',
                name: 'ref',
                maxLength: 45,
                allowBlank: false,
                emptyText: 'Entrez une référence',
                anchor: '100%'
            },
    ...
    });
    ...
     var displayAddProject = new Ext.Window({
            title: 'Ajouter un nouveau projet',
            id: 'addproject',
            width: 500,
            height: 500,
            layout: 'fit',
            items: new Ext.form.FormPanel({
                height: 500,
                items: [{
                    xtype: 'textfield',
                    pageSize: 10,
                    hideTrigger: true,
                    fieldLabel: 'Référence*',
                    id: 'ref',
                    name: 'ref',
                    maxLength: 45,
                    allowBlank: false,
                    emptyText: 'Entrez une référence',
                    anchor: '100%'
                },
                {
                    xtype: 'combo',
                    store: clientStore,
                    tpl: '<tpl for="."><div class="x-combo-list-item">{fullName}, {zip}, {city}</div></tpl>',
                    displayField: 'fullName',
                    name: 'fullName',
                    fieldLabel: 'Client(e)*',
                    emptyText: 'Sélectionner un(e) client(e)',
                    typeAhead: true,
                    triggerAction: 'all',
                    selectOnFocus: true,
                    allowBlank: false,
                    mode: 'remote',
                    anchor: '100%',
                    listeners: {
                        select: function(f, r, i) {
                            if (i == 0) {
                                displayAddClient.show();
                            }
                        }
                    }
                },
                {
                    xtype: 'textfield',
                    pageSize: 10,
                    hideTrigger: true,
                    fieldLabel: 'Nom du projet*',
                    id: 'name',
                    name: 'name',
                    maxLength: 45,
                    allowBlank: false,
                    emptyText: 'Entrez un nom pour ce projet',
                    anchor: '100%'
                }]
            }),
            buttons: [{
                text: 'Sauvegarder',
                handler: function() {
                    displayAddProject.items.items[0].getForm().submit({
                        url: '/set/project/updateProject/write/',
                        waitTitle: 'Sauvegarde',
                        waitMsg: 'Sauvegarde en cours...',
                        success: function(f, a) {
                            projectStore.reload(); // reload method of a store, uses last load options
                            displayAddProject.hide(); // hide this windowForm
                        },
                        failure: function(f, a) {
                            Ext.Msg.alert('Erreur', 'Echec de la sauvegarde du nouveau projet.');
                        }
                    });
                }
            },
            {
                text: 'Annuler',
                handler: function() {
                    displayAddProject.hide();
                }
            }]
        });
    If I change the name and id on formPanel code, That's okay. but here, the name and id into formPanel code and the name and id into the window code is egual.

    Can you help me?

    If that's possible, I don't want to change this informations because is writed into my php code and I don't want double the php function.

  7. #7

    Default

    up

  8. #8

    Default

    up

  9. #9
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You can't have 2 components with the same id (component ids need to be unique!).

    I suggest replacing id with itemId. You won't be able to use Ext.getCmp(id) anymore, but container.getComponent(itemId) will still work.

    You can have multiple components with the same name, but it can cause problems on Internet Explorer because it has a buggy getElementById implementation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •