[mapserver-users] Templates and javascript

Armin Burger armin.burger at territoriumonline.com
Thu Aug 23 04:36:21 EDT 2001


I got problems when trying to change query template contents using
javascript. In the header template I created an array with the dBase field
names.
....
gFldString = new Array();
...
gFldString[4] = ['[GEMD]', '[GEMI]', '[GEME]'];
....

Then in the query template I wanted to change the field based on another
variable (here the language for a multilingual application). I put in the
template

...
<td>[AREA]</td>
<td><script language=JavaScript>document.write(gFldString[4][thelanguage]);<
/script></td>
...
with "thelanguage" between 0 and 2.

This way the field name like [GEMD] instead of the field value is written
into the output table. When I try it with

<td><script language=JavaScript>document.write('[GEMD]');</script></td>

the field values are written correctly. I havent an idea why the string
'[GEMD]' is treated different when inserted directly and when taken from an
array.

Any help appreciated.

Armin

--
Armin Burger
Territorium Online
Siemensstrasse/Via Siemens 19 - 39100 Bozen/Bolzano - Italia
_



More information about the mapserver-users mailing list