[OpenLayers-Users] Can't update a feature for which there is no FID (WFS-T)

Eric Lemoine eric.lemoine at camptocamp.com
Wed Feb 10 12:07:56 EST 2010


On Wednesday, February 10, 2010, paweluz <paweluz at o2.pl> wrote:
>
> Hi!
>
> I have problem with WFS-T ADD state. I my application the user is able to
> add, update and delete a feature from map. The problem appears if:
> 1. User draw new geometry on map, fill out the attributes of new object and
> click SAVE to database.
> 2. Then user click on the new object on map. The attributes of the object
> appear.
> 3. User is trying to modify or delete the object... Then I got an alert
> Can't update a feature for which there is no FID
> I check it in firebug, and the FID is null. Why is that... The real funny
> think is that when I change the zoom of the map, or click F5, or in layer
> switch a uncheck and check my wfs_layer, the FID of my new object is changed
> to correct!! Now the user is able to remove or change the geometry (object)
> on map. Did anyone have this problem?
> Here is code for adding new object into the database
>
>                 feature.layer.eraseFeatures([feature]);
>                 feature.geometry = new OpenLayers.Geometry.MultiLineString(
>                     feature.geometry
>                 );
>                                 selectedfeature=feature;
>                 feature.state = OpenLayers.State.INSERT;
>                 feature.layer.drawFeature(feature);
>                 my_wfslayer.commit();
>
>
> If I add the line  my_wfslayer.refresh();  at

what if you do refresh({force: true}); ?



-- 
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