--- loncom/homework/radiobuttonresponse.pm 2004/12/23 17:08:22 1.97 +++ loncom/homework/radiobuttonresponse.pm 2005/01/31 22:00:40 1.99 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # mutliple choice style responses # -# $Id: radiobuttonresponse.pm,v 1.97 2004/12/23 17:08:22 albertel Exp $ +# $Id: radiobuttonresponse.pm,v 1.99 2005/01/31 22:00:40 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -114,7 +114,7 @@ sub start_foilgroup { } sub storesurvey { - if ( !defined($ENV{'form.submitted'})) { return ''; } + if ( !&Apache::response::submitted() ) { return ''; } my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1']}; &Apache::lonxml::debug("Here I am!:$response:"); if ( $response !~ /[0-9]+/) { return ''; } @@ -137,7 +137,7 @@ sub grade_response { my ($max,$randomize)=@_; #keep the random numbers the same must always call this my ($answer,@whichfoils)=&whichfoils($max,$randomize); - if (!defined($ENV{'form.submitted'})) { return; } + if ( !&Apache::response::submitted() ) { return; } my $response; if ($ENV{'form.submitted'} eq 'scantron') { $response=&Apache::response::getresponse(); @@ -606,7 +606,10 @@ sub end_foil { my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval); if ($value ne 'unused') { my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); - if (!$name) { $name=$Apache::lonxml::curdepth; } + if (!$name) { + &Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction."); + $name=$Apache::lonxml::curdepth; + } if (defined($Apache::response::foilnames{$name})) { &Apache::lonxml::error(&mt("Foil name [_1] appears more than once. Foil names need to be unique.",$name)); }