I think you have to define the SQL query for suggest option with depend 
field val. Here is an example for the 2d field that depend on field1

             <field type="s" name="field2" description="Field 2" 
wildcard="0" size="15">
                 <definition type="suggest" connectiontype="db" 
startleft="1" sort="asc" minlength="4" dependfld="field1">
                     <dsn encoding="UTF-8">@</dsn>
                     <sql>SELECT DISTINCT field2 FROM schema.table WHERE 
field1 = '[dependfldval]'  AND field2 ~* '[search]' ORDER BY field2</sql>
                       <events></events>
                 </definition>
             </field>

NB: it is possible to use many depend fields, but if it doesn't works 
already, maybe I've forgotten to commit something...
             <field type="s" name="field1" description="Field 1" 
wildcard="0" size="15">
<events>onchange="$('#pmsfld_field2').val('');$('#pmsfld_field2').flushCache();"</events>
             </field>
             <field type="s" name="field2" description="Field 2" 
wildcard="0" size="15">
                 <definition type="suggest" connectiontype="db" 
startleft="1" sort="asc" minlength="4" dependfld="field1">
                     <dsn encoding="UTF-8">@</dsn>
                     <sql>SELECT DISTINCT field2 FROM schema.table WHERE 
field1 = '[dependfldval]' AND field2 ~* '[search]' ORDER BY att1</sql>
<events>onchange="$('#pmsfld_field3').val('');$('#pmsfld_field3').flushCache();"</events>
                 </definition>
             </field>
             <field type="s" name="field3" description="Field 3" 
wildcard="0" size="15">
                 <definition type="suggest" connectiontype="db" 
startleft="1" sort="asc" minlength="4" dependfld="field1,field2">
                     <dsn encoding="UTF-8">@</dsn>
                     <sql>SELECT DISTINCT field3 FROM schema.table WHERE 
field1 = '[dependfldval_field1 ]' AND field2 = '[dependfldval_field2]' 
AND field3 ~* '[search]' ORDER BY field3</sql>
                       <events>....</events>
                 </definition>
             </field>

Le 27/03/2013 14:15, Chris forum a écrit :
> Hi all,
>
> I am having a hard time getting to work a search with 2 fields, second one
> being dependant of the first one.
> I especially would like to do that with data coming from PGSQL .
>
> I know there are examples in the search.xml of the wiki, but I am not able
> to reproduce them with the demo data:
> - "Cities Options Suggest MS": P.MAPPER ERROR: This version of PHP does
> support dBase functions
> - "Communes Suggest PG": I can not find where to download the PGSQL
> database gisdb
>
> Does anyone have a link where to get gisdb database?
>
> Here under what I tried with my own shapefile data.
> This sort of work, but the second field is not filtered according to what
> has been chosen on the first field.
>
> <searchitem name="Test" description="Test -Options Suggest MS-">
>              <layer type="shape" name="building _shp">
>
>                 <field type="s" name="TYPE" description="Building Type"
> wildcard="2">
>                      <definition type="options" connectiontype="ms"
> sort="asc" firstoption="*">
>                          <mslayer encoding="ISO-8859-1" keyfield="TYPE"
> showfield="TYPE"/>
>
> <events>onchange="$('#pmsfld_NUMBER').val('').flushCache()"</events>
>                      </definition>
>                  </field>
>
>                    <field type="s" name="NUMBER" description="Building
> Number" wildcard="2">
>                        <definition type="suggest" connectiontype="ms"
> minlength="1" startleft="1" sort="asc" dependfld="TYPE">
>                        <mslayer encoding="ISO-8859-1" keyfield="NUMBER"
> showfield="NUMBER"/>
>                        </definition>
>                    </field>
>
>              </layer>
>          </searchitem>
>
>
> Regards,
> Chris
> ------------------------------------------------------------------------------
> Own the Future-Intel&reg; Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game
> on Steam. $5K grand prize plus 10 genre and skill prizes.
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
> _______________________________________________
> pmapper-users mailing list
> pmapper-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pmapper-users
>
>

-- 


Thomas RAFFIN
Chef de Projet Internet
traf...@sirap.fr <mailto:traf...@sirap.fr>      Sirap <http://sirap.fr>         
Tel 
: 04 75 72 84 10
Fax : 04 75 70 07 98
Rue Paul Louis Héroult - BP 253
26106 Romans cedex

------------------------------------------------------------------------------
Own the Future-Intel&reg; Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game 
on Steam. $5K grand prize plus 10 genre and skill prizes. 
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to