From: Mike G. v. a. <we...@ma...> - 2005-06-29 16:22:33
|
Log Message: ----------- Fixed bug in radio_cmp closing bug #258. We now check to make sure that only a single string is being passed and not an array. (The latter occurs if checkboxes are used instead of radio buttons.) The presence of two checked checkboxes triggers a warning. Modified Files: -------------- pg/macros: PGanswermacros.pl Revision Data ------------- Index: PGanswermacros.pl =================================================================== RCS file: /webwork/cvs/system/pg/macros/PGanswermacros.pl,v retrieving revision 1.29 retrieving revision 1.30 diff -Lmacros/PGanswermacros.pl -Lmacros/PGanswermacros.pl -u -r1.29 -r1.30 --- macros/PGanswermacros.pl +++ macros/PGanswermacros.pl @@ -2650,8 +2650,15 @@ #added 6/28/2000 by David Etlinger #exactly the same as strict_str_cmp, #but more intuitive to the user + +# check that answer is really a string and not an array +# also use ordinary string compare sub radio_cmp { - strict_str_cmp( @_ ); + #strict_str_cmp( @_ ); + my $response = shift; # there should be only one item. + warn "Multiple choices -- this should not happen with radio buttons. Have + you used checkboxes perhaps?" if ref($response); + str_cmp($response); } ########################################################################## |