[ic] How to search ranges with drop down list?

Paul Jordan interchange-users@icdevgroup.org
Tue Oct 1 15:44:05 2002


> Hi.. I'm using 4.8.6 with foundation. In the docs, I see the following
> example of range searching.
>
>   <INPUT TYPE="hidden" NAME="mv_range_look" VALUE="price">
>         Search on Price
>     Min <SELECT NAME="mv_range_min">
>              <OPTION value=0 SELECTED> Free
>              <OPTION value=1000000> $1,000,000
>              <OPTION value=10000000> $10,000,000
>              <OPTION value=20000000> $20,000,000
>              <OPTION value=40000000> $40,000,000
>         </SELECT><BR>
>     Max <SELECT NAME="mv_range_max">
>             <OPTION value=0 SELECTED> no object
>             <OPTION value=1000000> $1,000,000
>             <OPTION value=10000000> $10,000,000
>             <OPTION value=20000000> $20,000,000
>             <OPTION value=40000000> $40,000,000
>         </SELECT>
>
>
> I want instead a single dropdown list from which I can select preset
> ranges (like 1000-2000, 2001-3000). Can anyone think of a way to do
> this? I've tried many things that don't work....
>
> DB


Have the search page just be a basic form input, then build and process your
search on your results page. So on your search page, among other things you
would have:

     Min <SELECT NAME="range">
              <OPTION value=0 SELECTED> Free
              <OPTION value=range_a> $1,000,000 - $10,000,000
              <OPTION value=range_b> $10,000,000 - 20,000,000
              <OPTION value=range_c> $20,000,000 - $40,000,000
         </SELECT>



then on your results page you could:
 [search-region
         more=1
         search="
         st=db
         rl=price
[if value range eq range_a] [then]
	   rn=1000000
         rx=20000000

[elsif value range eq range_b]
	   rn=20000000
         rx=40000000

.....and so on

You can integrate this if-else into a "shell" loop-search to just control
the ranges. I have changed all my searches to be collect-input-page to
search-processing-page, I think it really gives you more control.

If you are going to throw in other search specs, you might want to change
from a range search to a co=yes and have several =< and => entries. you know
what I mean :)

Paul