views:

8

answers:

0

I have a number of data layers defined in the following manner:

var mylayer = new OpenLayers.Layer.TMS("MY LAYER NAME", "", { type: "png", getURL: my_layer_geturl, isBaseLayer: false, visibility: false, attribution: 'Some Attribution text' });

Which I add to the map and it appears on the layer switcher and all is well etc. However, I have noticed that the resulting HTML contains the following:

<div class="dataLayersDiv">
    <input type="checkbox" id="OpenLayers.Control.LayerSwitcher_29_input_MY LAYER NAME" name="MY LAYER NAME" value="MY LAYER NAME">
    <span class="labelSpan" style="vertical-align: baseline;">MY LAYER NAME</span>
    <br>
</div>

You will notice that the form input ID and NAME both contain the layer name verbatim. This seems a little odd to me as the ID and NAME attributes can quite easily become invalid. To compound matters, I wish to add some markup to the layer labels in order to show/hide the layer names in different languages. Having markup in the form fields is a) rubbish and b) causing IIS to complain of 'potentially unsafe requests' when a form is submitted (asp.net webforms, single form wrapping the page so can't really escape it without a load of work!)

I know how to circumvent the unsafe page request warning but my admin will throw a bit of a stop if I do. I was wondering if anyone out there knows of a way to neatly set the layer labels without interfering with the underlying control markup?

Cheers, Steve