From 25857ba9ac36cf80d9505e6f6f0b390844fa146d Mon Sep 17 00:00:00 2001
From: Bob Kuo <bob@celect.org>
Date: Sat, 15 Aug 2009 18:14:15 -0500
Subject: [PATCH] fixes RT #36583: malformed output from checkbox_group (with -no_xhtml flag)
---
lib/CGI.pm | 2 +-
t/checkbox_group.t | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
create mode 100644 t/checkbox_group.t
diff --git a/lib/CGI.pm b/lib/CGI.pm
index 3bf17db..775871c 100644
--- a/lib/CGI.pm
+++ b/lib/CGI.pm
@@ -2475,7 +2475,7 @@ sub _box_group {
CGI::label($labelattributes,
qq(<input type="$box_type" name="$name" value="$_" $checkit$other$tab$attribs$disable/>$label)).${break};
} else {
- push(@elements,qq/<input type="$box_type" name="$name" value="$_"$checkit$other$tab$attribs$disable>${label}${break}/);
+ push(@elements,qq/<input type="$box_type" name="$name" value="$_" $checkit$other$tab$attribs$disable>${label}${break}/);
}
}
$self->register_parameter($name);
diff --git a/t/checkbox_group.t b/t/checkbox_group.t
new file mode 100644
index 0000000..61e1bc4
--- /dev/null
+++ b/t/checkbox_group.t
@@ -0,0 +1,12 @@
+#!/usr/local/bin/perl -w
+
+use Test::More tests => 2;
+
+BEGIN { use_ok('CGI'); };
+use CGI (':standard','-no_debug','-no_xhtml');
+
+is(checkbox_group(-name => 'game',
+ '-values' => [qw/checkers chess cribbage/],
+ '-defaults' => ['cribbage']),
+ qq(<input type="checkbox" name="game" value="checkers" >checkers <input type="checkbox" name="game" value="chess" >chess <input type="checkbox" name="game" value="cribbage" checked >cribbage),
+ 'checkbox_group()');
--
1.6.3.1