Hi Kristian,

You have to do something like this (this function is called in the
onChange of a textbox)

function changeDescription(val) {
        if (popupFeature) {
                popupFeature.attributes.OMSCHRIJVING = val;
                if ((!popupFeature.state || popupFeature.state ==
OpenLayers.State.UNKNOWN)) {
                        popupFeature.state = OpenLayers.State.UPDATE;
                }
        }
}

Popupfeature is the feature that is currently modified
OMSCHRIJVING is an attribute (column in the database)

This way you're label can be rendered with the Style of the layer
automatically and stored in the db

Cheers kris
-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of Frost89
Sent: Wednesday, March 24, 2010 1:52 PM
To: [email protected]
Subject: [OpenLayers-Users] Draw a point and assign a dynamic label to
it


Hi list

In my map I have added a vector layer and a drawFeature control.
The drawFeature is set to draw points, and works without problems.

Now, I would like to assign a text-label to the point's style.
The text in the label should be defined by the user (through a prompt()
or
other alternatives).

So I was thinking about settings this value in the "featureAdded" event
of
the drawFeature control, but I can't quite figure out how to do this.
When I try to do it like this...
var point = new OpenLayers.Control.DrawFeature(
  vectorLayer,
  OpenLayers.Handler.Point,
  {
    type: OpenLayers.Control.TYPE_TOOL,
    featureAdded: function(event) {
      event.style.label = 'test';
      redliningLayer.drawFeature(event);
    }
  }
);
... I just get an error message:
event.style is null
So if anyone has an idea of how to do this, it would be appreciated :)

- Kristian Frost
-- 
View this message in context:
http://n2.nabble.com/Draw-a-point-and-assign-a-dynamic-label-to-it-tp479
0691p4790691.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to