--- loncom/homework/inputtags.pm 2006/10/17 15:11:11 1.209 +++ loncom/homework/inputtags.pm 2006/11/01 23:24:52 1.210 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.209 2006/10/17 15:11:11 albertel Exp $ +# $Id: inputtags.pm,v 1.210 2006/11/01 23:24:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -283,7 +283,7 @@ sub needs_exam_box { sub start_textline { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result = ""; - my $id = &start_input($parstack,$safeeval); + my $input_id = &start_input($parstack,$safeeval); if ($target eq 'web') { $Apache::lonxml::evaluate--; my $partid=$Apache::inputtags::part; @@ -294,7 +294,14 @@ sub start_textline { if ($size eq '') { $size=20; } else { if ($size < 20) { $maxlength=$size; } } - my $oldresponse = &HTML::Entities::encode($Apache::lonhomework::history{"resource.$partid.$id.submission"},'<>&"'); + my $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"}; + &Apache::lonxml::debug("oldresponse $oldresponse is ".ref($oldresponse)); + + if (ref($oldresponse) eq 'ARRAY') { + $oldresponse = $oldresponse->[$#Apache::inputtags::inputlist]; + } + $oldresponse = &HTML::Entities::encode($oldresponse,'<>&"'); + if ($Apache::lonhomework::type ne 'exam') { my $addchars=&Apache::lonxml::get_param('addchars',$parstack,$safeeval); $result='';