From 1604417d65f6b36b671723d4adaaa5591d43c45a Mon Sep 17 00:00:00 2001 From: Geoff Goehle Date: Fri, 30 Aug 2013 16:57:51 -0400 Subject: [PATCH] Backported fix for Visible/Reduced Credit Enabled checkboxes always being marked. --- .../Instructor/ProblemSetList2.pm | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm index bad2d04631..289f9fada1 100644 --- a/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm +++ b/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetList2.pm @@ -2245,25 +2245,28 @@ sub fieldEditHTML { } if ($type eq "checked") { - + # FIXME: kludge (R) # if the checkbox is checked it returns a 1, if it is unchecked it returns nothing # in which case the hidden field overrides the parameter with a 0 - # kludge 2 -- get visible and reduced scoring to have no names (might reduce accessibility) - # my $label_text = $properties->{label_text} || "NoLabel"; - return WeBWorK::CGI_labeled_input( - -type=>"checkbox", - -id=>$fieldName."_id", - -label_text=>"", #$label_text, - -input_attr=>{ - -name => $fieldName, - -checked => $value, - -label => "", - -value => 1 - } + my %attr = ( name => $fieldName, + label => "", + value => 1 + ); + + $attr{'checked'} = 1 if ($value); + + + return WeBWorK::CGI_labeled_input( + -type=>"checkbox", + -id=>$fieldName."_id", +# The labeled checkboxes are making the table very wide. + -label_text=>"", +# -label_text=>ucfirst($fieldName), + -input_attr=>\%attr ) . CGI::hidden( - -name => $fieldName, - -value => 0 + -name => $fieldName, + -value => 0 ); } }