[mapserver-users] understanding runtime substitution usage

umbertofilippo at tiscali.it umbertofilippo at tiscali.it
Tue Nov 28 05:38:36 PST 2017


Good day list!

I am trying to do a runtime substitution to pass a parameter from a form to my mapfile, but cannot geti t to work.

Let's say I have a mapfile which looks like (only relevant part):

	LAYER
	  NAME zone
	  ...
	  FILTER ('[vitigni]' = '%vitigni%')
              END

I have a form in my HTML with a dropdown list where some values are listed.
I'd like to pick the value selected by the user and pass it to my FILTER, in place of the %vitigni%.

I tried with the below form.

                <form name="mapserv" method="GET" action="http://localhost/cgi-bin/mapserver/mapserv.exe?">
		<input type="hidden" name="map" value="//nbgis01/mapserver/umbe/mapfile/test10_runtimesubstitution.map">
		<select name="[vitigni]">
                        		<option value="Chardonnay, Pinot nero, Pinot bianco">Chardonnay, Pinot nero, Pinot bianco</option>
                        		<option value="Marzemino, Barbera, Schiava gentile, Cabernet">Marzemino, Barbera, Schiava gentile, Cabernet</option>
                        		<option value="Trebbiano di Soave">Trebbiano di Soave</option>
                        		<option value="Groppello, Marzemino, Barbera, Sangiovese.">Groppello, Marzemino, Barbera, Sangiovese.</option>
                    	</select>
		<br><br>
		<input type="submit" value="Click Me">
                </form>

Only thing I receive is: http://localhost/cgi-bin/mapserver/mapserv.exe?map=%2F%2Fnbgis01%2Fmapserver%2Fumbe%2Fmapfile%2Ftest10_runtimesubstitution.map&%5Bvitigni%5D=Chardonnay%2C+Pinot+nero%2C+Pinot+bianco
I know this is not the right way the request should be created.
If I manually replace %vitigni% with one of the values provided in the form modifying the mapfile, everything works, proving the mapfile is correct (es. FILTER ('[vitigni]' = ' Chardonnay, Pinot nero, Pinot bianco ')).

Any suggestion would be very appreciated! Thanks



More information about the mapserver-users mailing list