Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have 11 text fields in my searchform. I want to let the user search select attributes and left rest blank. I would like to disable empty text fields after click Submit button. Because empty fields sends an empty string to my WFS service. Is it possible to do it ?

Also I want to notify the user if did not fill in any field.

Thanks in advance

formPanel = new GeoExt.form.FormPanel({
    ref: "formPanel",
    title:"Wyszukiwarka",

    collapsible: true,
    width: 150,

    region: "west",
    protocol: protocol,
    buttons:[
    {text: 'Czyść',
    width: 60,
handler: function(){
formPanel.getForm().reset();
}},
    {
     text: "Szukaj",
        width: 70,
     handler: function() {
         formPanel.getForm().search();
     },
     //scope: formPanel
 }],
    items: [{
        xtype: "numberfield",
        name: "trans_id__eq",
           cls : 'myCls',
           emptyText:"",
        value: "",
        submitEmptyText: false,
        //fieldLabel: "ID",
        //disabled: true,

    },

    {
        xtype: "textfield",
        name: "dokument__eq",
        // emptyText:"Dokument",
          cls : 'myCls',
        value: "",
        disabled: true,
       // fieldLabel: "nabywca",
            //allowBlank: false

    },
    {
        xtype: "textfield",
        name: "data_transakcji__eq",
           cls : 'myCls',
           //emptyText:"Data Transakcji",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    },
    {
        xtype: "textfield",
        name: "typ_nier__eq",
           cls : 'myCls',
          // emptyText:"Typ nieruchomości",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    },
    {
        xtype: "textfield",
        name: "cena_tran__eq",
           cls : 'myCls',
          // emptyText:"Cena transakcji",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    },
    {
        xtype: "textfield",
        name: "cena_1m2_dlk__eq",
           cls : 'myCls',
           //emptyText:"Cena 1m2",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    },
    {
        xtype: "textfield",
        name: "pow_m2__eq",
           cls : 'myCls',
           //emptyText:"Powierzchnia",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    },
    {
        xtype: "textfield",
        name: "sprzedawca__eq",
           cls : 'myCls',
          // emptyText:"Sprzedawca",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    },
    {
        xtype: "textfield",
        name: "nabywca__eq",
           cls : 'myCls',
          // emptyText:"Nabywca",
        value: "",
        //fieldLabel: "ID",
    disabled: true,

    },
    {
        xtype: "textfield",
        name: "wspx__eq",
           cls : 'myCls',
          // emptyText:"WspX",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    },
        {
        xtype: "textfield",
        name: "wspy__eq",
           cls : 'myCls',
          // emptyText:"WspY",
        value: "",
        //fieldLabel: "ID",
        disabled: true,

    }



    ],
    listeners: {
        actioncomplete: function(form, action) {
        // this listener triggers when the search request
        // is complete, the OpenLayers.Protocol.Response
        // resulting from the request is available
        // through "action.response"
            features = action.response.features;
            app.featureGrid.store.loadData(features);   //załadowanie zwróconego wyniku wyszukiwania do "app.featureGrid.store"
            vm=app.mapPanel.map.getLayersByName("Wynik wyszukiwania");
            if(vm.length==0){
                vecLayer = new OpenLayers.Layer.Vector("Wynik wyszukiwania");
               app.mapPanel.map.addLayer(vecLayer);
                app.featureGrid.store.bind(vecLayer);
                app.featureGrid.getSelectionModel().bind(vecLayer);
            //app.featureGrid.getSelectionModel().bind(vectorLayer);
        }
    }
    }




})


    );
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.