Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] "Select All" check box for swish.cgi

From: David Brown <dave(at)not-real.davidhbrown.us>
Date: Thu Jun 24 2010 - 11:25:27 GMT
Troy, 

That thread seems to be more about the interaction of a web browser passing
an empty string from a select to Perl/CGI than about swish-e. But since you
asked about checkboxes...

The checkbox markup in that thread was:

<input type="checkbox" name="si" value="0">Search Corporate Site
<input type="checkbox" name="si" value="1">Search Corporate Site
<input type="checkbox" name="si" value="2">Search Corporate Site

Here's the beginning of a solution for you:

<input id="si0" type="checkbox" name="si" value="0" /><label
for="si0">Search Corporate Site 0</label>
<input id="si1" type="checkbox" name="si" value="1" /><label
for="si1">Search Corporate Site 1</label>
<input id="si2" type="checkbox" name="si" value="2" /><label
for="si2">Search Corporate Site 2</label>
<input id="siall" type="checkbox"
onchange="document.getElementById('si0').checked =
document.getElementById('si1').checked =
document.getElementById('si2').checked = this.checked" /><label
for="siall">Search ALL Corporate Sites</label>


With this code, toggling the "Search ALL..." checkbox will set the three
others to match but because "siall" does not have a name/value, nothing
changes in what's sent to the server; it's still guided by what's selected
in the three main checkboxes.

If I were to deploy something like this, I would probably also write a
function for the other checkboxes' onchange handler to see whether all of
them were set  and set siall accordingly. 

I'm not sure how Perl works; in PHP, I'd make that name="si[]" so that
multiple values will be combined in an array; otherwise, the last value
received wins.

(Note also the use of the label tag; this is particularly important in these
days of fat-finger browsers.)

Dave
--
Dave Brown
dave@davidhbrown.us

-----Original Message-----
From: users-bounces@lists.swish-e.org
[mailto:users-bounces@lists.swish-e.org] On Behalf Of Troy Wical
Sent: Wednesday, June 23, 2010 11:53 PM
To: Swish-e Users Discussion List
Subject: [swish-e] "Select All" check box for swish.cgi

I found an email thread from a few years ago about trying to do this, but
I'm not sure if it would still apply after the changes that swish.cgi has
gone through since then.

This is the thread: http://swish-e.org/archive/2003-11/6465.html

Does anyone have thoughts on how to get a "search all" box available?

Peace, Troy
_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users

_______________________________________________
Users mailing list
Users@lists.swish-e.org
http://lists.swish-e.org/listinfo/users
Received on Thu Jun 24 07:25:40 2010