[mapserver-users] Templates and javascript
Stephen Lime
steve.lime at dnr.state.mn.us
Thu Aug 23 10:55:47 PDT 2001
The array access syntax looks wrong. Shouldn't gFldString[4][thelanguage] be
gFldString[thelanguage]?
Steve
Stephen Lime
Internet Applications Analyst
Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> Armin Burger <armin.burger at territoriumonline.com> 08/23/01 03:36AM >>>
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