Gossamer Forum
Home : Products : DBMan : Customization :

One drop down (two fields)

Quote Reply
One drop down (two fields)
I want to have a drop down menu box in my database that has three values in it.

They are "Full", "Medium" and "Low" but "Full" and "Medium" appear in the 11th field while "Low" appears in the 10th field.

Is it possible to have one drop down menu box with those three values in it? I'm wanting to use this drop down menu in my search.

Quote Reply
Re: One drop down (two fields) In reply to
In the FAQ noted below under the section "Searching" there is a thread called "Search multiple fields with dropdown menu" which may provide what you need.

If not, there are other threads which address this issue also.



Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: One drop down (two fields) In reply to
Thanks LoisC. I'll have a look.

Quote Reply
Re: One drop down (two fields) In reply to
I've applied the code from the "Search multiple fields with dropdown menu" thread but it doesn't work in association with my other search fields.

Is there anything I can do to make it work in association wtih the other fields on my search?

Quote Reply
Re: One drop down (two fields) In reply to
What do you mean they are not working in association?

What code did you add in sub query?

Did you remember to use: $in{'ma'} = 1;

Perhaps if you posted the code you used it would help to see what you have done already.

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: One drop down (two fields) In reply to
In Reply To:
What do you mean they are not working in association?
I have the following fields on my search page:

Name
Region
Type which has (Full, Allied, OTOC)

but the "Type" field doesn't work with the Name and Region fields. For example if I enter Wellington into the Region field and select Full it should bring up all the "Full" members in Wellington but it only brings up all the "Full" members (not all the full members in Wellington).

Hopefully that makes some sense.

In Reply To:
What code did you add in sub query?
sub query {
# --------------------------------------------------------
# First let's get a list of database fields we want to search on and
# store it in @search_fields

my ($i, $column, @search_fields, @search_gt_fields, @search_lt_fields, $maxhits, $numhits, $nh,
$field, @regexp, $line, @values, $key_match, @hits, @sortedhits, $next_url, $next_hit, $prev_hit,
$first, $last, $upper, $lower, $left, $right, $restricted);
local (%sortby);


if ($in{'search_field'}) {
$in{'Full'} = $in{'search_field'};
$in{'Allied'} = $in{'search_field'};
$in{'OTOC'} = $in{'search_field'};
$in{'ma'} = 1;
}



---- removed extra coding ----
Quote Reply
Re: One drop down (two fields) In reply to
I think you misunderstood the instructions within the thread you read.

It states that the field names should be entered ... not what you are searching for.

So:

if ($in{'search_field'}) {
$in{'Full'} = $in{'search_field'};
$in{'Allied'} = $in{'search_field'};
$in{'OTOC'} = $in{'search_field'};
$in{'ma'} = 1;
}

Should actually be:

if ($in{'search_field'}) {
$in{'Name'} = $in{'search_field'};
$in{'Region'} = $in{'search_field'};
$in{'Type'} = $in{'search_field'};
$in{'ma'} = 1;
}

Or at least that is how i would interpret what the thread is saying to do.


Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: One drop down (two fields) In reply to
Sorry Lois I was actually wrong with the fields. I have the following fields:

Name - Name of the Company
Region - Region of the Company
Full - Can only have the value "Full" in it
Allied - Can only have the value "Allied Supplier" in it.
OTOC - Can only have the value "OTOC" in it.

Does that mean to get it working I would use this code:

if ($in{'search_field'}) {
$in{'Name'} = $in{'search_field'};
$in{'Region'} = $in{'search_field'};
$in{'Full'} = $in{'search_field'};
$in{'Allied'} = $in{'search_field'};
$in{'OTOC'} = $in{'search_field'};
$in{'ma'} = 1;
}

Could you also tell me how the code would look for the "drop down menu" please? I want to have the following values in the "drop down menu":

Full
Allied Supplier
OTOC

Thanks Smile