checkbox — return user-supplied value if its length is 1 or more, an empty string otherwise
The filter checks for the length of input. When the length of input is non-zero, the filter returns input itself. When the length is zero, the filter returns an empty string.
The filter is suitable for retrieving values out of HTML checkboxes.
Interchange 5.9.0:
Source: code/Filter/checkbox.filter
Lines: 17
# Copyright 2002-2007 Interchange Development Group and others
# Copyright 1996-2002 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
#
# $Id: checkbox.filter,v 1.3 2007-03-30 23:40:44 pajamian Exp $
CodeDef checkbox Filter
CodeDef checkbox Routine <<EOR
sub {
my $val = shift;
return length($val) ? $val : '';
}
EOR