Dear Bill,
Thanks! It works just fine. Im using 'TemplateToolkit.pm', in
'get_limit_select' i have modified the following:
---
my @options = (
-name => 'sbm',
-values => $limit->{values},
-labels => $limit->{labels} || {},
);
---
to what you suggested:
---
my $labels = $limit->{labels} || {};
$labels->{''} = '--select--'; # Head of popup_menu
my @options = (
-name => 'sbm',
-values => [ '', @{$limit->{values}}],
-labels => $labels,
);
Thanks again. It's a pretty cool feature that you can use this
select-by-meta together with the ExtractPath option. I have build a DB of
courses (teaching material), using the described features i can let the user
limit the search to a specific course, GR8!!
Best,
Peter
----- Original Message -----
From: "Bill Moseley" <moseley@hank.org>
To: "Multiple recipients of list" <swish-e@sunsite.berkeley.edu>
Sent: Wednesday, March 31, 2004 6:12 PM
Subject: [SWISH-E] Re: swish.cgi - select_by_meta - popup_menu - problem
> On Wed, Mar 31, 2004 at 06:30:40AM -0800, Peter Morling wrote:
>
> > It works fine, but when using the popup_menu option, the default value
is
> > always '01' (sbm=01, when the request is created). I would like to set
the
> > selected value to 'nothing', but i don't know how? It's not a problem in
> > e.g. a html document, there i can set the selected value to something
like:
> >
> > ---
> > <select name="sbm">
> > <option selected="selected" value="">Head of the popup_menu...</option>
> > ---
>
> That's what I would recommend doing. It's a display issue so add code
> into the template module (I'm not sure which you are using) to do that.
>
> For example, if you are using the TemplateDefault output module you
> would see this code:
>
> my @options = (
> -name => 'sbm',
> -values => $limit->{values},
> -labels => $limit->{labels} || {},
> );
>
> So to add a default might do instead:
>
> my $labels = $limit->{labels} || {};
> $labels->{''} = '--select--';
> my @options = (
> -name => 'sbm',
> -values => [ '', @{$limit->{values}}],
> -labels => $labels,
> );
>
>
> which creates a blank select items like you did above. If you are using
> the other template modules (HTML::Template or Template-Toolkit) then you
> will need to look in those modules.
>
>
> The swish.cgi script is suppose to work out of the box, and to be
> customizable to some degree, but if you really want a customized script
then
> consider looking at search.cgi in the distribution which tries harder to
> separate the HTML from the code and doesn't include all the extra code
> that swish.cgi has to make it general purpose.
>
> --
> Bill Moseley
> moseley@hank.org
Received on Fri Apr 2 00:55:56 2004