[Users] Question about FormPanel

truongxuan quang truongxuanquang at yahoo.com
Mon Nov 29 19:01:24 CET 2010


Thank you very much, I wrote my remain problem here, I hope you can help me one 
more time 





I am trying to do as this 
examplehttp://ian01.geog.psu.edu/geoserver/www/search/gazetteer.html  

for searching by using WFS as example functions bellow: 
 var protocol= OpenLayers.Protocol.WFS({
        url: "http://ian01.geog.psu.edu/geoserver/wfs",
        featureType: "pop_places",
        featureNS: "http://geovista.psu.edu"
    });

    formPanel = new GeoExt.form.FormPanel({
        title: "Place Name Search",
        height: 150,
        region: "north",
        protocol: protocol,
        items: [{
            xtype: "textfield",
            width: 200,
            name: "name__like",
            //value: "State College",
            fieldLabel: "name <br />(use * and . for wildcards)",
            allowBlank: false,
            minLength: 4,
        }],
        listeners: {
            actioncomplete: function(form, action) {
                features = action.response.features;
                store.loadData(features);
                vm=map.getLayersByName("Results");
                if(vm.length===0){
                    vecLayer = new OpenLayers.Layer.Vector("Results");
                    map.addLayer(vecLayer);
                    store.bind(vecLayer);
                    select.bind(vecLayer);
                }
            }
        },
        buttons: [{text: 'search',
            handler: function(){
                formPanel.search();
            }
        }],
        keys: [{ key: [Ext.EventObject.ENTER], 
            handler: function() {
                formPanel.search();
            }
        }]
    });
when I use FireBug for checking GET method in console is showed GET 
http://ian01.geog.psu.edu/geoserver/wfs
==>In my case, I change above code for exactly my cases as bellow:


var protocol= OpenLayers.Protocol.WFS({
        url: "http://localhost:8080/geoserver/wfs",
        featureType: "municipalities",
        featureNS: "topp" 
        OR 
        "http://www.openplans.org/topp"
    });
formPanel = new GeoExt.form.FormPanel({
        title: " Search",
        height: 150,
        region: "north",
        protocol: protocol,
        items: [{
            xtype: "textfield",
            name: "name__like",
            fieldLabel: "Population=",
        },
        {
                  xtype: 'textfield',
                  fieldLabel: '  Population  >',
                  name: 'POPULATION__ge'

             }],
        listeners: {....same above exampleothers functions are configured all 
most same above..

when I check my wfs by using uDig, it showed municipalities layers at :

http://localhost:8080/geoserver/wfs?VERSION=1.0.0&SERVICE=WFS&REQUEST=GetCapabilities#topp:municipalities


I  used Firebug for bug GET method but in console window's Firebug showed 
nothing, 


Could you please have a look for my protocol for 'municipalities'  feature is it 
correct or not..? 

If it corrected please have a look down and note for other function if there is 
made errors for my searching function 



Many thanks 

Quang
 





________________________________
From: Matt Priour <mpriour at kestrelcomputer.com>
To: truongxuan quang <truongxuanquang at yahoo.com>; users at geoext.org
Sent: Sat, November 27, 2010 4:35:50 AM
Subject: Re: [Users] Question about FormPanel


The 1st thing you need when developing against any  OWS (WMS,WFS,WMC,CWS,etc..) 
is a way to actually see the message to &  response from the server. You can use 
Fiddler (PC Only) or Firebug  (Firefox) or (to a much more limited degree) 
WebKit Developer  Tools.
 
Without tools like this, you are really just  shooting in the dark.
 
Assuming that all the code below is correct and you  are using Geoserver, then 
you MUST get the featureNS value.
It is pretty easy, just logon to Geoserver and look  at the layer list. We'll 
take the tiger:poi layer as an example.
On the Layers list you see Type, Workspace, Store,  & Layer Name columns. The 
ones you are interested in are Workspace and Layer  Name columns. For the 
tiger:poi example you can either use:
featureType:'tiger:poi', (that is the layer name  with the namespace)
featureNS:'http://www.census.gov' (that is the  Workspace URI)
 
-- OR --
 
featureType:'poi' (that is the layer name, without  the namespace)
featureNS:'tiger' (that is the namespace, which is  the same as the Workspace)
 
the first example is really the 'correct' way, but  the second way works as 
well.
 
Hope that helps
 
NOTE: If you are using other servers, like  Mapserver, then using namespaces can 
sometimes cause issues.
 
Matt Priour


From: truongxuan quang 
Sent: Friday, November 26, 2010 5:28 PM
To: users at geoext.org 
Subject: [Users] Question about FormPanel

Hello List,

I am trying to do search function  following example in this site 
http://ian01.geog.psu.edu/geoserver/www/search/gazetteer.html 


I wrote almost same the above  example given, I change only in my data what I 
istalled in Geoserver 


 var protocol= OpenLayers.Protocol.WFS({
        url: "http://localhost:8080/geoserver/wfs",
        featureType: "municipaliteis",
        //featureNS: "http://geovista.psu.edu/" I dont know how to fix this line
    });

    formPanel = new GeoExt.form.FormPanel({
        title: "Place Name Search",
        height: 150,
        region: "north",
        protocol: protocol,
        items: [{
            xtype: "textfield",
            width: 200,
            name: "name__like",
            minLength: 4
        },
		xtype: "textfield",
            width: 200,
            name: "population__ge"
		],
        listeners: {
            actioncomplete: function(form, action) {
                features = action.response.features;
                store.loadData(features);
                vm=map.getLayersByName("Results");
                if(vm.length===0){
                    vecLayer = new OpenLayers.Layer.Vector("Results");
                    map.addLayer(vecLayer);
                    store.bind(vecLayer);
                    select.bind(vecLayer);
                }
            }
        },
        buttons: [{text: 'search',
            handler: function(){
                formPanel.search();
            }
        }],
        keys: [{ key: [Ext.EventObject.ENTER], 
            handler: function() {
                formPanel.search();
            }
        }]
    });

I tried for all most one week to fix it, but it still not working... When I 
click to command button "search" it did not show any thing. If some one have 
experience about this work please write me a command.

Thank in advance 

Quang  

________________________________
 _______________________________________________
Users mailing  list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20101129/7096a8f8/attachment-0001.htm 


More information about the Users mailing list