I was having some issues implementing graphical markers on a vector layer. I trace the bug to the fact that the offsetX and offsetY where being paseed to the OpenLayers JS as strings. It then does something like:

(offsetX + 20).toFixed();

The toFixed() call fails because the part in the parens is evaluated as a string. As a quick fix, I form_altered the style ui form and added a submit handler that runs all the integer 'data' values through intval(). I suspect that a better solution is to properly prepare the data before it is rendered as javascript?

Comments

zzolo’s picture

Hey @te-brian. Thanks for the catch, but this should already be fixed in the dev version. Can you try this out?

batje’s picture

That fixed it for me. thanx.

tmcw’s picture

Status: Active » Closed (fixed)

Great, closing this issue.

batje’s picture

Status: Fixed » Active

reopening.

This does fix the issue with number, but now, if you enter

${yourfieldnameofchoice}

and press save, the form returns with a value of 0.

And, not sure if this should be a seperate ticket, its very close though.

if you fill in the 'externalGraphic' field, the string value is stored correctly. But during rendering, nothing is done with the value. its just inserted plain into the javascript.

tmcw’s picture

Version: 6.x-2.0-alpha8 » 6.x-2.x-dev
Status: Closed (fixed) » Active

Callback functions are currently not supported in this module, because we're working on an implementation based around flexible plugins. Supporting enforced-numbers sometimes and callbacks other times won't happen in the releases, for sure, but if you need this functionality, you can export a style and edit the export.

zzolo’s picture

Status: Active » Fixed

Good catch. Should be fixed in this commit, by not casting strings of form "${attr}"
http://drupal.org/project/cvs/177400

zzolo’s picture

Side note, @tmcw, that syntax works for attribute replacement as well, so if you add fields to a view, and it was working before I made the casting update.

te-brian’s picture

Status: Active » Fixed

Just to confirm, the dev version does indeed fix the issue I was having. Thanks zzolo.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.