[mapserver-users] R: understanding runtime substitution usage
umbertofilippo at tiscali.it
umbertofilippo at tiscali.it
Tue Nov 28 06:24:24 PST 2017
I tried that but that did not do the trick.
I removed it from the HTML, but I keep it in the mapfile (as if I remove it
it does not work anymore).
So, what I am trying to do is showing my WMS filtered with the value
specified in the form.
>From what I've read in the docs
(http://www.mapserver.org/cgi/runsub.html#filters), VALIDATION is also
mandatory from version 6 onward, so I've included it.
I simplified my testcase to this:
mapfile
LAYER
NAME zone
...
FILTER ('[vitigni]' = '%vitigni%')
VALIDATION
"vitigni" "^[a-zA-Z\-]+$"
END
END
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="Groppello"> Groppello
</option>
</select>
<br><br>
<input type="submit" value="Click Me">
</form>
When I click "Click Me" I receive:
mapserv(): Web application error. Traditional BROWSE mode requires a
TEMPLATE in the WEB section, but none was provided.
And the URL looks like (obviously wrong):
http://localhost/cgi-bin/mapserver/mapserv.exe?map=%2F%2Fnbgis01%2Fmapserver
%2Fumbe%2Fmapfile%2Ftest10_runtimesubstitution.map&vitigni=Groppello
-----Messaggio originale-----
Da: trondmm at main.crusaders.no [mailto:trondmm at main.crusaders.no] Per conto
di Trond Michelsen
Inviato: martedì 28 novembre 2017 15:04
A: Mapserver <mapserver-users at lists.osgeo.org>
Cc: umbertofilippo at tiscali.it
Oggetto: Re: [mapserver-users] understanding runtime substitution usage
Try to remove the brackets from the parameter name
<select name="[vitigni]">
should be
<select name="vitigni">
--
Trond Michelsen
On Tue, Nov 28, 2017 at 02:38:36PM +0100, umbertofilippo at tiscali.it wrote:
> 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
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list