Skip to main content.
home | support | download

Back to List Archive

Re: swish.cgi - select_by_meta - popup_menu - problem

From: Bill Moseley <moseley(at)>
Date: Wed Mar 31 2004 - 16:13:28 GMT
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
Received on Wed Mar 31 08:13:29 2004