For those interested, here is my solution. No doubt there is a better way to accomplish the same thing, but it works. I am writing a lengthy explanation so that this might help you with your implementation.
On the list page, insert an asp code snippet where you want to see the checkbox. An explanation follows.
'begin asp code snippet
%>
<script language="jscript">
function checkclosed()
{
var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
if (document.getElementById("closed").checked)
{
location.href=sPage+'?a=advsearch&type=and&asearchfield%5B%5D=ClosedDate¬_ClosedDate=on&asearchopt_ClosedDate=Empty&bolcheckbox=true'
}
else
{
location.href=sPage+'?a=search&value=1&SearchFor=&SearchOption=Empty&SearchField=ClosedDate'
}
}
</script>
<%
if request.querystring("bolcheckbox") = "true" then
bolCheckBox="checked"
Else
bolCheckBox=""
end if
response.write "<INPUT type=""checkbox"" id=""closed"" name=""closed"" " & bolCheckBox & " onClick=""checkclosed()"">"
response.write "Show closed requests"
'end asp code snippet
The %> tag closes the vbscript section so that a jscript section can be inserted. Note that the vbscript section is opened again after the jscript end tag (</script).
The checkclosed function first gets the current page name so that the redirect to the search page is relative to the current page. I have multiple list pages with different filters, so I wanted a more generic function.
Next, the the function checks for the checkbox id 'checked' property. If the property is set to true, the box is checked, which causes the page to be reloaded with the specified search parameters in the query string. In this case, search for records where the "ClosedDate" field is NOT empty. Note the addition of the query string "bolCheckBox=true", which I will get to in a moment.
If the checkbox checked property is not set to true (the else statement), the page is loaded witht he query string specifying records where the "closedDate: field IS empty.
Now, the script checks the request string for the value of "bolCheckBox". The purpose of this is to set the checkbox property to checked or unchecked. When the page reloads, the checkbox default would be unchecked, but if the page is loaded as result of checking the box, I want the box to remain checked. Conversely, if I have just unchecked the box, the querysting will not have the "bolCheckBox" value, so the checkbox will now show as unchecked.
The final two lines are simple the checkbox and the text to appear next to it.
I've also added a Before SQL query event for this page:
'begin before sql query code
if request.querystring("bolcheckbox") = "true" then
strSQL = AddWhere(strSQL, "[ClosedDate]IS NOT null")
Else
strSQL = AddWhere(strSQL, "[ClosedDate]IS null")
end if
'end before sql query code
This ensures that the page loads with the correct record set on initial visit and when opening the page from another link.
There you have it, I hope this is of use to someone.