Re: [htdig] problems with build_select_lists

Subject: Re: [htdig] problems with build_select_lists
From: Gilles Detillieux (
Date: Mon Oct 02 2000 - 09:24:08 PDT

According to Daniel Lang:
> I am experiencing some difficulties while trying
> to use build_select_lists.
> One problem is, that it seems that htsearch cannot detect
> it right if the current value of a parameter is part of the
> list. Although this is the case, the additional default parameter
> (label the last element of the build_select_list octuple) is
> created and selected. No matter which of the values the parameter
> has.
> The second problem might be, that I'm missing something, but
> in this particular case, a select list variable doesn't get expanded.
> I will again double check my form-templates and the configs, but
> I already did that. So the best is probably I send the files to
> anyone willing to have a look and suggest what I am doing wrong.
> I will now give a short example for the first problem, and quoting
> the relevant sections of my htdig.conf.
> [..]
> build_select_lists: EXCLUDE_LIST exclude exclude_pattern_list 2 1 2 \
> exclude_pattern "unknown"
> [..]
> I use tabs, maybe this can cause the problem ?
> Just comes to my mind ....
> [..]
> exclude_pattern_list: "linux" "Linux" \
> "BSD" "BSD" \
> "ports" "Ports" \
> "packages" "Packages" \
> "" "No Excludes"
> exclude_pattern: ""
> [..]

Here's the problem. You can't arbitrarily define or redefine which config
attribute is associated with which input parameter. The exclude_pattern
attribute is one you made up, while the exclude input parameter ends up
being stored in the "exclude" config attribute.

Granted, the documentation is pretty weak in this area, so you almost need
to look at the code to be sure of all parameter to attribute associations
of this sort. Anyway, your exclude input parameter will not have any
effect on your statically defined exclude_pattern, so the value of the
former will never be seen by the build_select_lists code.

This is not to say that you can't make up your own attribute names. You
can, and the exclude_pattern_list is an example of such. The key is to
realise that any attribute names you make up must also be referenced in
your config file, either through a ${attribute_name} construct, or as the
third item in the build_select_lists octuple. The seventh item must be
the name of an attribute that the program uses internally as well, or it
will have no effect.

> Now the variable $(EXCLUDE_LIST) does expand to such a list,
> but, initially the "exclude" parameter is empty (or should be),
> although there is an entry in the pattern list, an additional one
> is created labelled 'unknown' and this is selected.
> The same if any other value is selected.
> e.g. if exclude=BSD (in the query string), the created list
> (in HTML) looks like this:
> [..]
> <select name="exclude">
> <option value="linux">Linux
> <option value="BSD">BSD
> <option value="ports">Ports
> <option value="packages">Packages
> <option value="">No Excludes
> <option value="BSD" selected>unknown
> </select>
> [..]
> You see, that the BSD value is created twice, the selected one carries
> the default label.
> As far as I have understood it, the BSD value already present should
> have been selected, and the default labelled value should only
> be created, if the current value is not part of the list.

It doesn't pick up any item in your exclude_pattern_list because
nothing there matches the static value of exclude_pattern. The former
is parsed as a quoted string list, while the latter is not. So, your
exclude_pattern attribute remains set as "" (literally two double
quotes), which matches neither the BSD value in exclude_pattern_list
nor the empty string associated with the name string "No Excludes".
That's why it comes up with "unknown". To set a string attribute,
as opposed to a quoted string list, to an empty string, you must set
it to nothing. E.g.:


Gilles R. Detillieux              E-mail: <>
Spinal Cord Research Centre       WWW:
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig mailing list, send a message to You will receive a message to confirm this. List archives: <> FAQ: <>

This archive was generated by hypermail 2b28 : Mon Oct 02 2000 - 11:38:27 PDT