[OpenLayers-Users] wfs update

Eric Lemoine eric.lemoine at camptocamp.com
Thu Jul 16 12:37:46 EDT 2009


On Thursday, July 16, 2009, Gabriel Nolasco
<nolasco_gabriel at yahoo.com.br> wrote:
>
> Hi!
>
> I’m trying to update feature’s attributes on a WFS layer without successes.
>
> This is my layer instantiation:
>
> var myWFSLayer = new OpenLayers.Layer.WFS(
>         "myWFSLayerName",
>         "myWFSLayerServiceURL",
>         {typename: 'topp:myWFSLayerTypename'},
>         {
>                 typename: "myWFSLayerTypename",
>                 featureNS: "http://www.openplans.org/topp",
>                 extractAttributes: true
>         }
> );
>
>
> My feature attributes:
>
> var myAttributes = {
>         "myField1": "myAttribute1",
>         "myField2": "myAttribute2"
> }
>
>
> If I commit a new feature setting the state to “insert” the transaction succeeds and the feature is stored with its attributes:
>
> myNewFeature.state = OpenLayers.State.INSERT;
> myNewFeature.attributes = myAttributes;
> myWFSLayer.commit();
>
>
> However, if I set a previously existent feature state to "update" there are no changes in the database after the commit and the feature keeps its old attributes:
>
> myOldFeature.state = OpenLayers.State.UPDATE;
> myOldFeature.attributes = myAttributes;
> myWFSLayer.commit();
>
>
> I’m using postgreSQL 8.3 + GeoServer 1.7.5 + OpenLayers 2.8
> Anyone has an idea about what I’m missing?


Hi. I haven't looked at your code into detail but if you use
OpenLayers 2.8 it is highly recommended that you use
OpenLayers.Layer.Vector with OpenLayers.Protocol.WFS instead of
OpenLayers.Layer.WFS. Look at the wfs example.


>
> Thanks in advance,
> Gabriel Nolasco
>

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list