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 a two textfields in FormPanel. When one of them is empty, after pressing the search button the form sends the empty string in WFS query. How can I disable the empty field which sends the WFS request after I pressed the search button?

    formPanel = new GeoExt.form.FormPanel({
    ref: "formPanel",
    width: 300,
    height: 200,
    region: "west",
    protocol: protocol,
    buttons:[{
     text: "search",
     handler: function() {
         formPanel.getForm().search();
     },
     //scope: formPanel
 }],
    items: [{
        xtype: "textfield",
        name: "trans_id__eq",
        value: "",
        fieldLabel: "ID",
        disabled: true,
        ref: 'myTextField'
    },

    {
        xtype: "textfield",
        name: "nabywca__eq",
        value: "",
        fieldLabel: "nabywca",
        submitEmptyText: false 
    },
    ],
    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("Results");
            if(vm.length==0){
                vecLayer = new OpenLayers.Layer.Vector("Results");
               app.mapPanel.map.addLayer(vecLayer);
                app.featureGrid.store.bind(vecLayer);
                app.featureGrid.getSelectionModel().bind(vecLayer);
            //app.featureGrid.getSelectionModel().bind(vectorLayer);
        }
    }
    }




})


    );

When I leave blank first textfield and put the value to the second my wfs request send empty string and I get the error.

My protocol:

var protocol= OpenLayers.Protocol.WFS({

            version: "1.1.0",
            url: "http://localhost:8080/geoserver/wfs",
            featureType: "transakcje_punkty",
            featureNS: "http://geoserver.org/transakcje",
             srsName: "EPSG:900913"


        });

Wfs is working properly when I have one field, but I would like to add 7 "textfields". The user fills the fields with the attributes he want to find and rest leaves empty. But empty field send some empty value to WFS and I get an error.... instead results

share|improve this question
2  
add some code to your question, so people can help you to solve your problem. –  Gery Jun 25 '13 at 13:13
    
and where is your protocol? –  Gery Jun 25 '13 at 14:56

1 Answer 1

Try replacing

name: "trans_id__eq",

by

name: "transid__eq",

post also your protocol as part of your code, probably there is something wrong there.

Hope this helps,

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.