The error you're getting is because no mode is set. That's the output from the form supposed to be? If it's just the resulting map then add a hidden variable called mode with a value of map. The filter and validation look ok to me. --Steve
-----Original Message----- From: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of umbertofili...@tiscali.it Sent: Tuesday, November 28, 2017 8:24 AM To: 'Trond Michelsen' <trondmm-mapser...@crusaders.no>; 'Mapserver' <mapserver-users@lists.osgeo.org> Subject: [mapserver-users] R: understanding runtime substitution usage 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: tron...@main.crusaders.no [mailto:tron...@main.crusaders.no] Per conto di Trond Michelsen Inviato: martedì 28 novembre 2017 15:04 A: Mapserver <mapserver-users@lists.osgeo.org> Cc: umbertofili...@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, umbertofili...@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@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users