Skip to main content.
home | support | download

Back to List Archive

Re: HTML SELECT boxes and multiple indexes

From: David White <dswhite42(at)not-real.yahoo.com>
Date: Wed Nov 19 2003 - 22:22:24 GMT
--- moseley@hank.org wrote:
> > My kludge to work around this so far has been to edit swish.cgi
> > (2.4.0
> > release version) and change line 1382 from:
> > 
> >     if ( !@choices ) {
> > 
> > to:
> > 
> >     if ( !@choices  || ($#choices == 0 && !$choices[0])) {
> > 
> > It's a ugly hack, but at the moment it's the only way I know how to
> > accomplish what I want to do.  Does anyone have a better suggestion
> > how I could tackle this problem?
> 
> I wonder if you could do this instead.
> 
>     my @choices = $q->param('si') if $q->param('si');
> 

Oops! We got tripped up by Perl's boolean functions.  If the user
chooses this option:

  <option value="0">First indexed site

then $choices[0] will have a value of "0" which returns "false" for
both

  if (!$choices[0])

and 

  if ($q->param('si'))

I modified line 1382 in swish.cgi again to this:

  if ( !@choices  || ($#choices == 0 && $choices[0] eq "")) {

which seems to work, though it's still pretty kludgey.  But at least I
can't think of any downsides or hidden gotchas that would result from
this change...

=====

=-=-= David =-=-=




__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
Received on Wed Nov 19 22:23:04 2003